use of maspack.render.Renderable in project artisynth_core by artisynth.
the class MultiPointSpring method computeDefaultMaxWrapDisplacement.
private double computeDefaultMaxWrapDisplacement() {
double mind = Double.POSITIVE_INFINITY;
CompositeComponent comp = ComponentUtils.nearestEncapsulatingAncestor(this);
if (comp instanceof Renderable) {
mind = RenderableUtils.getRadius((Renderable) comp) / 10;
}
for (Wrappable w : myWrappables) {
if (w instanceof HasSurfaceMesh) {
PolygonalMesh mesh = ((HasSurfaceMesh) w).getSurfaceMesh();
if (mesh != null) {
OBB obb = new OBB(mesh);
Vector3d widths = new Vector3d();
obb.getWidths(widths);
double hw = widths.minElement() / 2;
if (hw < mind) {
mind = hw / 2;
}
}
}
}
if (mind == Double.POSITIVE_INFINITY) {
mind = 1.0;
}
return mind;
}
use of maspack.render.Renderable in project artisynth_core by artisynth.
the class SimpleCollide method setTopObject.
private void setTopObject(Collidable comp, ObjectType type) {
Renderable rcomp = (Renderable) comp;
((TransformableGeometry) comp).transformGeometry(new RigidTransform3d(0, /*-0.3*/
0.0, mySeparation));
((TransformableGeometry) comp).transformGeometry(AffineTransform3d.createScaling(myTopScale));
RenderProps.setFaceColor(rcomp, Color.red);
switch(type) {
case FemEllipsoid:
case FemSphere:
case FemCube:
{
RenderProps.setPointColor(rcomp, Color.gray);
RenderProps.setAlpha(rcomp, 0.3);
RenderProps.setDrawEdges(rcomp, true);
RenderProps.setVisible(((FemModel3d) rcomp).getElements(), false);
break;
}
case House:
{
((TransformableGeometry) comp).transformGeometry(new RigidTransform3d(0, 0, 2 * mySeparation, 1, 1, 0, Math.toRadians(170)));
break;
}
case Box:
case Molar:
case Bin:
case Paw:
{
break;
}
default:
{
throw new InternalErrorException("Unimplemented type " + type);
}
}
myTopObject = comp;
myTopType = type;
}
Aggregations