| 47 |
|
Shape* ShapeBuilder::createShape(StuntDouble* sd) { |
| 48 |
|
Shape* currShape = NULL; |
| 49 |
|
if (sd->isDirectionalAtom()) { |
| 50 |
< |
currShape = internalCreateShape(static_cast<Atom*>(sd)); |
| 50 |
> |
currShape = internalCreateShape(static_cast<DirectionalAtom*>(sd)); |
| 51 |
|
} else if (sd->isAtom()) { |
| 52 |
< |
currShape = internalCreateShape(static_cast<DirectionalAtom*>(sd)); |
| 52 |
> |
currShape = internalCreateShape(static_cast<Atom*>(sd)); |
| 53 |
|
} else if (sd->isRigidBody()) { |
| 54 |
|
currShape = internalCreateShape(static_cast<RigidBody*>(sd)); |
| 55 |
|
} |
| 97 |
|
|
| 98 |
|
if (gayBerneData != NULL) { |
| 99 |
|
GayBerneParam gayBerneParam = gayBerneData->getData(); |
| 100 |
< |
currShape = new Ellipsoid(datom->getPos(), gayBerneParam.GB_sigma, gayBerneParam.GB_l2b_ratio, datom->getA()); |
| 100 |
> |
currShape = new Ellipsoid(datom->getPos(), gayBerneParam.GB_sigma/2.0, gayBerneParam.GB_l2b_ratio*gayBerneParam.GB_sigma/2.0, datom->getA()); |
| 101 |
|
} else { |
| 102 |
|
sprintf( painCave.errMsg, |
| 103 |
|
"Can not cast GenericData to GayBerneParam\n"); |
| 111 |
|
painCave.isFatal = 1; |
| 112 |
|
simError(); |
| 113 |
|
} |
| 114 |
+ |
}else if (atomType->isLennardJones()){ |
| 115 |
+ |
GenericData* data = atomType->getPropertyByName("LennardJones"); |
| 116 |
+ |
if (data != NULL) { |
| 117 |
+ |
LJParamGenericData* ljData = dynamic_cast<LJParamGenericData*>(data); |
| 118 |
+ |
|
| 119 |
+ |
if (ljData != NULL) { |
| 120 |
+ |
LJParam ljParam = ljData->getData(); |
| 121 |
+ |
currShape = new Spheric(datom->getPos(), ljParam.sigma/2.0); |
| 122 |
+ |
} else { |
| 123 |
+ |
sprintf( painCave.errMsg, |
| 124 |
+ |
"Can not cast GenericData to LJParam\n"); |
| 125 |
+ |
painCave.severity = OOPSE_ERROR; |
| 126 |
+ |
painCave.isFatal = 1; |
| 127 |
+ |
simError(); |
| 128 |
+ |
} |
| 129 |
+ |
} |
| 130 |
+ |
|
| 131 |
|
} |
| 132 |
|
return currShape; |
| 133 |
|
} |
| 139 |
|
for (atom = rb->beginAtom(ai); atom != NULL; atom = rb->nextAtom(ai)) { |
| 140 |
|
Shape* currShape = NULL; |
| 141 |
|
if (atom->isDirectionalAtom()){ |
| 142 |
< |
currShape = internalCreateShape(static_cast<Atom*>(atom)); |
| 142 |
> |
currShape = internalCreateShape(static_cast<DirectionalAtom*>(atom)); |
| 143 |
|
}else if (atom->isAtom()){ |
| 144 |
< |
currShape = internalCreateShape(static_cast<DirectionalAtom*>(atom)); |
| 144 |
> |
currShape = internalCreateShape(static_cast<Atom*>(atom)); |
| 145 |
|
} |
| 146 |
|
if (currShape != NULL) |
| 147 |
|
compositeShape->addShape(currShape); |