Search in sources :

Example 16 with Point3d

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");
}
Also used : Point3d(maspack.matrix.Point3d)

Example 17 with Point3d

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");
}
Also used : Point3d(maspack.matrix.Point3d)

Example 18 with Point3d

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;
}
Also used : Point3d(maspack.matrix.Point3d)

Example 19 with Point3d

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));
}
Also used : Point3d(maspack.matrix.Point3d)

Example 20 with Point3d

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;
}
Also used : Point3d(maspack.matrix.Point3d)

Aggregations

Point3d (maspack.matrix.Point3d)464 Vector3d (maspack.matrix.Vector3d)128 ArrayList (java.util.ArrayList)59 RigidTransform3d (maspack.matrix.RigidTransform3d)48 Vertex3d (maspack.geometry.Vertex3d)35 Point (artisynth.core.mechmodels.Point)30 PolygonalMesh (maspack.geometry.PolygonalMesh)30 Face (maspack.geometry.Face)25 ReaderTokenizer (maspack.util.ReaderTokenizer)19 IOException (java.io.IOException)18 RotationMatrix3d (maspack.matrix.RotationMatrix3d)17 Vector2d (maspack.matrix.Vector2d)16 VectorNd (maspack.matrix.VectorNd)16 IntegrationPoint3d (artisynth.core.femmodels.IntegrationPoint3d)15 HashMap (java.util.HashMap)14 Muscle (artisynth.core.mechmodels.Muscle)13 FemNode3d (artisynth.core.femmodels.FemNode3d)12 Particle (artisynth.core.mechmodels.Particle)12 BufferedReader (java.io.BufferedReader)11 Plane (maspack.matrix.Plane)11