Class TriangularPyramid

  • All Implemented Interfaces:
    MeshMaker

    public class TriangularPyramid
    extends Model
    implements MeshMaker
    Create a wireframe model of a tetrahedron as a triangular pyramid with an equilateral triangle base (centered at the origin in the xz-plane) whose three vertices are connected to a 4th vertex on the positive y-axis.
    See Also:
    Tetrahedron
    • Constructor Summary

      Constructors 
      Constructor Description
      TriangularPyramid()
      Create a regular tetrahedron having side length sqrt(3)/sqrt(2), with one face in the xz-plane with its center at the origin, and the 4th vertex on the positive y-axis at height 1.
      TriangularPyramid​(double s)
      Create a regular tetrahedron having side length s, with one face in the xz-plane with its center at the origin, and with the 4th vertex on the positive y-axis at height s*sqrt(2)/sqrt(3).
      TriangularPyramid​(double r, double h)
      Create a tetrahedron with one face being an equilateral triangle inscribed in a circle of radius r centered at the origin of the xz-plane and with the 4th vertex on the y-axis at height h.
      TriangularPyramid​(double r, double h, int n, int k)
      Create a tetrahedron with one face being an equilateral triangle inscribed in a circle of radius r centered at the origin of the xz-plane and with the 4th vertex on the y-axis at height h.
    • Field Detail

      • r

        public final double r
      • h

        public final double h
      • n

        public final int n
      • k

        public final int k
    • Constructor Detail

      • TriangularPyramid

        public TriangularPyramid()
        Create a regular tetrahedron having side length sqrt(3)/sqrt(2), with one face in the xz-plane with its center at the origin, and the 4th vertex on the positive y-axis at height 1.
      • TriangularPyramid

        public TriangularPyramid​(double s)
        Create a regular tetrahedron having side length s, with one face in the xz-plane with its center at the origin, and with the 4th vertex on the positive y-axis at height s*sqrt(2)/sqrt(3).
        Parameters:
        s - the length of the regular tetrahedron's sides
      • TriangularPyramid

        public TriangularPyramid​(double r,
                                 double h)
        Create a tetrahedron with one face being an equilateral triangle inscribed in a circle of radius r centered at the origin of the xz-plane and with the 4th vertex on the y-axis at height h.

        If h = r * sqrt(2), then the tetrahedron is a regular tetrahedron. with side length s = r * sqrt(3).

        Another way to state this is, if an equilateral triangle is inscribed in a circle of radius r, then the edge length of the triangle is r*sqrt(3) and the height of the regular tetrahedron made from the triangle is r*sqrt(2).

        Parameters:
        r - radius of circle in xz-plane that the equilateral base is inscribed in
        h - coordinate on the y-axis of the apex
      • TriangularPyramid

        public TriangularPyramid​(double r,
                                 double h,
                                 int n,
                                 int k)
        Create a tetrahedron with one face being an equilateral triangle inscribed in a circle of radius r centered at the origin of the xz-plane and with the 4th vertex on the y-axis at height h.

        If h = r * sqrt(2), then the tetrahedron is a regular tetrahedron. with side length s = r * sqrt(3).

        Another way to state this is, if an equilateral triangle is inscribed in a circle of radius r, then the edge length of the triangle is r*sqrt(3) and the height of the regular tetrahedron made from the triangle is r*sqrt(2).

        Parameters:
        r - radius of circle in xz-plane that the equilateral base is inscribed in
        h - coordinate on the y-axis of the apex
        n - number of lines of latitude around the body of the pyramid
        k - number of triangles in the triangle fan at the top of each side
        Throws:
        IllegalArgumentException - if n is less than 1
        IllegalArgumentException - if k is less than 1
    • Method Detail

      • remake

        public TriangularPyramid remake​(int n,
                                        int k)
        Description copied from interface: MeshMaker
        Build an instance of the Model with new values for the number of lines of latitude and longitude while keeping all the other model parameters the same.
        Specified by:
        remake in interface MeshMaker
        Parameters:
        n - number of lines of latitude for the returned Model
        k - number of lines of longitude for the returned Model
        Returns:
        a new instance of the Model with the updated parameters