Package com.j3d.engine.scene.nodes.util
Class Solids
java.lang.Object
com.j3d.engine.scene.nodes.util.Solids
Solids is a utility class for generating common 3D geometric shapes (solids)
composed of
GPoint, GLine, and GTri objects.
All generated solids are returned as Thing objects, which can then
be added to a SceneManager for rendering and interaction.
- Author:
- Lehlogonolo Poole
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ThingCreates a 3D prism object.Creates a 3D prism object.static voidCreates a triangle for the top or bottom face of a prism.
-
Constructor Details
-
Solids
public Solids()
-
-
Method Details
-
topFaceTri
public static void topFaceTri(HashSet<GLine> lines, GPoint p1, GPoint p2, GPoint centre, HashSet<GTri> tris) Creates a triangle for the top or bottom face of a prism.- Parameters:
lines- AnArrayListofGLineobjects to which the new lines forming the triangle will be added.p1- The firstGPointvertex of the triangle.p2- The secondGPointvertex of the triangle.centre- The centerGPointof the face, which serves as the third vertex of the triangle.tris- AnArrayListofGTriobjects to which the newly created triangle will be added. The triangle is formed by `p1`, `p2`, and `centre`.
-
prism
public static ArrayList<GObject> prism(double radius, int sideFaceAmts, SamePair<AxisPlane> planes, boolean randCol) Creates a 3D prism object.- Parameters:
radius- The radius of the prism's base.sideFaceAmts- The number of sides for the prism's base (e.g., 3 for a triangular prism, 4 for a square prism).planes- `SamePair` ofAxisPlaneobjects, where the first plane defines the bottom face and the second defines the top face.This method generates a prism by creating two n-gons (defined by `sideFaceAmts` and `radius`) on the specified bottom and top planes, and then connecting their corresponding vertices to form the side faces.
-
prism
public static Thing prism(double radius, int sideFaceAmts, Layer parentLayer, SamePair<AxisPlane> planes) Creates a 3D prism object.- Parameters:
radius- The radius of the prism's base.sideFaceAmts- The number of sides for the prism's base (e.g., 3 for a triangular prism, 4 for a square prism).parentLayer- The layer to which this prism will be added in the scene.planes- `SamePair` ofAxisPlaneobjects, where the first plane defines the bottom face and the second defines the top face.This method generates a prism by creating two n-gons (defined by `sideFaceAmts` and `radius`) on the specified bottom and top planes, and then connecting their corresponding vertices to form the side faces.
-