- java.lang.Object
-
- spice.basic.TriangularPlateVertices
-
public class TriangularPlateVertices extends java.lang.Object
Class TriangularPlateVertices represents triangular shapes in 3-dimensional space as sets of three 3-vectors.The order of a plate's vertices implies an "outward" normal direction: the vertices are ordered in the positive (counterclockwise) sense about the outward normal direction.
See the related class
TriangularPlate
which supports various geometric plate operations not covered by this class.Version 1.0.0 31-DEC-2016 (NJB)
-
-
Constructor Summary
Constructors Constructor Description TriangularPlateVertices()
No-arguments constructor.TriangularPlateVertices(double[][] vertices)
Construct a triangular plate from an array of three vertex arrays.TriangularPlateVertices(double[] v1, double[] v2, double[] v3)
Construct a triangular plate array from three vertex arrays.TriangularPlateVertices(TriangularPlateVertices p)
Copy constructor.This constructor generates a deep copy.TriangularPlateVertices(Vector3 v1, Vector3 v2, Vector3 v3)
Construct a triangular plate array from three Vector3 objects.
-
Method Summary
Modifier and Type Method Description private static void
checkArrayDim(java.lang.String caller, java.lang.String type, java.lang.String relation, int expectedDim, java.lang.Object[] vArray)
private static void
checkVertex(java.lang.String caller, int index, double[] v)
TriangularPlateVertices
expand(double delta)
Expand a triangular plate by a specified amount.The expanded plate is co-planar with, and has the same orientation as, the original.The centroids of the two plates coincide.Vector3
getCentroid()
Compute the centroid of a triangular plate.Vector3
getNearPoint(Vector3 point)
Find the nearest point on a triangular plate to a specified point.Vector3
getOutwardNormal()
Compute an outward normal vector of a triangular plate.The vector does not necessarily have unit length.double[][]
toArray()
Extract the vertices of a TriangularPlateVertices instance into a two-dimensional array of doubles.double[]
toArray1D()
Extract the vertices of a TriangularPlateVertices instance into a one-dimensional array of doubles.Vector3[]
toVectors()
Extract the vertices of a TriangularPlateVertices instance into an array of 3-vectors.
-
-
-
Field Detail
-
vertices
public Vector3[] vertices
-
-
Constructor Detail
-
TriangularPlateVertices
public TriangularPlateVertices()
No-arguments constructor. This constructor creates a set of zero vectors.
-
TriangularPlateVertices
public TriangularPlateVertices(Vector3 v1, Vector3 v2, Vector3 v3) throws SpiceErrorException
Construct a triangular plate array from three Vector3 objects.- Parameters:
v1
-v3
-v2
-- Throws:
SpiceErrorException
-
TriangularPlateVertices
public TriangularPlateVertices(double[] v1, double[] v2, double[] v3) throws SpiceErrorException
Construct a triangular plate array from three vertex arrays.- Parameters:
v1
-v3
-v2
-- Throws:
SpiceErrorException
-
TriangularPlateVertices
public TriangularPlateVertices(double[][] vertices) throws SpiceErrorException
Construct a triangular plate from an array of three vertex arrays.- Parameters:
vertices
-- Throws:
SpiceErrorException
-
TriangularPlateVertices
public TriangularPlateVertices(TriangularPlateVertices p)
Copy constructor.This constructor generates a deep copy.- Parameters:
p
-
-
-
Method Detail
-
checkArrayDim
private static void checkArrayDim(java.lang.String caller, java.lang.String type, java.lang.String relation, int expectedDim, java.lang.Object[] vArray) throws SpiceErrorException
- Throws:
SpiceErrorException
-
checkVertex
private static void checkVertex(java.lang.String caller, int index, double[] v) throws SpiceErrorException
- Throws:
SpiceErrorException
-
toVectors
public Vector3[] toVectors()
Extract the vertices of a TriangularPlateVertices instance into an array of 3-vectors.- Returns:
-
toArray
public double[][] toArray()
Extract the vertices of a TriangularPlateVertices instance into a two-dimensional array of doubles.- Returns:
-
toArray1D
public double[] toArray1D()
Extract the vertices of a TriangularPlateVertices instance into a one-dimensional array of doubles.- Returns:
-
getOutwardNormal
public Vector3 getOutwardNormal() throws SpiceErrorException
Compute an outward normal vector of a triangular plate.The vector does not necessarily have unit length.- Returns:
- Throws:
SpiceErrorException
-
expand
public TriangularPlateVertices expand(double delta) throws SpiceErrorException
Expand a triangular plate by a specified amount.The expanded plate is co-planar with, and has the same orientation as, the original.The centroids of the two plates coincide.delta is a fraction by which the plate is to be scaled. Scaling is done so that the scaled plate has the following properties: - it is co-planar with the input plate - its centroid coincides with that of the input plate - its sides remain parallel to the corresponding sides of the input plate - the distance of each vertex from the centroid is (1+delta) times the corresponding distance for the input plate
- Parameters:
delta
-- Returns:
- Throws:
SpiceErrorException
-
getNearPoint
public Vector3 getNearPoint(Vector3 point) throws SpiceErrorException
Find the nearest point on a triangular plate to a specified point.- Parameters:
point
-- Returns:
- Throws:
SpiceErrorException
-
getCentroid
public Vector3 getCentroid() throws SpiceErrorException
Compute the centroid of a triangular plate.- Returns:
- Throws:
SpiceErrorException
-
-