Class SolidPolygonPyramid
The pyramid has a square base and four triangular faces meeting at an apex (tip). Two constructors are provided for different use cases:
- Directional (recommended): Specify apex point and base center point. The pyramid points from apex toward the base center. This allows arbitrary orientation and is the most intuitive API.
- Y-axis aligned: Specify base center, base size, and height. The pyramid points in -Y direction (apex at lower Y). Useful for simple vertical pyramids.
Usage examples:
// Directional constructor: pyramid pointing from apex toward base
SolidPolygonPyramid directionalPyramid = new SolidPolygonPyramid(
new Point3D(0, -100, 0), // apex (tip of the pyramid)
new Point3D(0, 50, 0), // baseCenter (pyramid points toward this)
50, // baseSize (half-width of square base)
Color.RED
);
// Y-axis aligned constructor: pyramid pointing upward
SolidPolygonPyramid verticalPyramid = new SolidPolygonPyramid(
new Point3D(0, 0, 300), // baseCenter
50, // baseSize (half-width of square base)
100, // height
Color.BLUE
);
- See Also:
-
Field Summary
Fields inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
cachedBoundingBox, mouseInteractionController -
Constructor Summary
ConstructorsConstructorDescriptionSolidPolygonPyramid(Point3D baseCenter, double baseSize, double height, Color color) Constructs a solid square-based pyramid with base centered at the given point, pointing in the -Y direction.SolidPolygonPyramid(Point3D apexPoint, Point3D baseCenter, double baseSize, Color color) Constructs a solid square-based pyramid pointing from apex toward base center. -
Method Summary
Methods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
addShape, addShape, beforeTransformHook, extractSolidPolygons, getBoundingBox, getGroup, getLocation, getSubShapesRegistry, getTransform, getViewSpaceTracker, hideGroup, intersect, removeGroup, setBackfaceCulling, setCacheNeedsRebuild, setColor, setGroupForUngrouped, setMouseInteractionController, setRootComposite, setShadingEnabled, setTransform, showGroup, subtract, transform, unionMethods inherited from class eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
invalidateBounds
-
Constructor Details
-
SolidPolygonPyramid
Constructs a solid square-based pyramid pointing from apex toward base center.This is the recommended constructor for placing pyramids in 3D space. The pyramid's apex (tip) is at
apexPoint, and the square base is centered atbaseCenter. The pyramid points in the direction from apex to base center.Coordinate interpretation:
apexPoint- the sharp tip of the pyramidbaseCenter- the center of the square base; the pyramid "points" in this direction from the apexbaseSize- half the width of the square base; the base extends this distance from the center along perpendicular axes- The distance between apex and base center determines the pyramid height
- Parameters:
apexPoint- the position of the pyramid's tip (apex)baseCenter- the center point of the square base; the pyramid points from apex toward this pointbaseSize- the half-width of the square base; the base extends this distance from the center, giving a total base edge length of2 * baseSizecolor- the fill color applied to all faces of the pyramid
-
SolidPolygonPyramid
Constructs a solid square-based pyramid with base centered at the given point, pointing in the -Y direction.This constructor creates a Y-axis aligned pyramid. The apex is positioned at
baseCenter.y - height(above the base in the negative Y direction). For pyramids pointing in arbitrary directions, useSolidPolygonPyramid(Point3D, Point3D, double, Color)instead.Coordinate system: The pyramid points in -Y direction (apex at lower Y). The base is at Y=baseCenter.y, and the apex is at Y=baseCenter.y - height. In Sixth 3D's coordinate system, "up" visually is negative Y.
- Parameters:
baseCenter- the center point of the pyramid's base in 3D spacebaseSize- the half-width of the square base; the base extends this distance from the center along X and Z axes, giving a total base edge length of2 * baseSizeheight- the height of the pyramid from base center to apexcolor- the fill color applied to all faces of the pyramid
-