use of maspack.matrix.Point3d in project artisynth_core by artisynth.
the class Test method case2.
void case2(GLViewerFrame frame) {
Point3d pos1 = new Point3d(-1.0, 0.0, 0.0);
mesh1 = MeshFactory.createBox(1.0, 2.0, 3.0);
positionRigidMesh(mesh1, pos1);
setMeshRenderProps(mesh1, frame, Color.GREEN);
if (!mesh1.isClosed())
throw new RuntimeException("mesh1 not closed");
Point3d pos0 = new Point3d(0.01, 0.01, 0.01);
mesh2 = MeshFactory.createBox(1.0, 2.0, 3.0);
positionRigidMesh(mesh2, pos0);
setMeshRenderProps(mesh2, frame, Color.BLUE);
if (!mesh2.isClosed())
throw new RuntimeException("mesh0 not closed");
}
use of maspack.matrix.Point3d in project artisynth_core by artisynth.
the class Test method case1.
void case1(GLViewerFrame frame) {
double sphereRadius = 3.0;
Point3d sphere0Pos = new Point3d(0.0, 0.0, 0.0);
mesh2 = MeshFactory.createSphere(sphereRadius, 32);
if (!mesh2.isTriangular())
throw new RuntimeException("mesh not triangular");
positionRigidMesh(mesh2, sphere0Pos);
setMeshRenderProps(mesh2, frame, Color.BLUE);
if (!mesh2.isClosed())
throw new RuntimeException("mesh not closed");
if (!mesh2.isTriangular())
throw new RuntimeException("mesh not triangular");
mesh1 = MeshFactory.createSphere(sphereRadius, 32);
if (!mesh1.isTriangular())
throw new RuntimeException("mesh not triangular");
Point3d mesh1Pos = new Point3d(sphereRadius * 2 * 0.95, 0, 0);
positionRigidMesh(mesh1, mesh1Pos);
setMeshRenderProps(mesh1, frame, Color.GREEN);
if (!mesh1.isClosed())
throw new RuntimeException("mesh not closed");
if (!mesh1.isTriangular())
throw new RuntimeException("mesh not triangular");
}
use of maspack.matrix.Point3d in project artisynth_core by artisynth.
the class Function1x3 method eval.
@Override
public void eval(double in, double[] out) {
Point3d tmp = eval(in);
out[0] = tmp.x;
out[1] = tmp.y;
out[2] = tmp.z;
}
use of maspack.matrix.Point3d in project artisynth_core by artisynth.
the class GaussianFunction3x1 method eval.
public double eval(Point3d in) {
Point3d tmp = new Point3d(in);
tmp.mul(A, in);
return s * Math.exp(tmp.dot(in) + m.dot(in));
}
use of maspack.matrix.Point3d in project artisynth_core by artisynth.
the class DistanceGridFeatureQuery method nearestVertexToPoint.
/**
* Returns the nearest mesh vertex to a point, using a specified distance grid
*
* @param dgrid distance-grid containing the vertices.
* @param pnt point for which the nearest vertex should be found.
* @return the nearest vertex to the point, or <code>null</code> if
* <code>dgrid</code> contains no vertices.
*/
public Vertex3d nearestVertexToPoint(DistanceGrid dgrid, Point3d pnt) {
Point3d nearest = new Point3d();
Feature feat = dgrid.getNearestWorldFeature(nearest, pnt);
if (feat instanceof Vertex3d) {
return (Vertex3d) feat;
}
return null;
}
Aggregations