Class Solids

java.lang.Object
com.j3d.engine.scene.nodes.util.Solids

public class Solids extends Object
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 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 - An ArrayList of GLine objects to which the new lines forming the triangle will be added.
      p1 - The first GPoint vertex of the triangle.
      p2 - The second GPoint vertex of the triangle.
      centre - The center GPoint of the face, which serves as the third vertex of the triangle.
      tris - An ArrayList of GTri objects 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` of AxisPlane objects, 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` of AxisPlane objects, 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.