Class Grid2D
java.lang.Object
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCompositeShape
eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.wireframe.Grid2D
A 2D grid of line segments lying in the XY plane (Z = 0 in local space).
The grid is divided into configurable numbers of cells along the X and Y axes,
producing a regular rectangular mesh of lines.
This shape is useful for rendering floors, walls, reference planes, or any
flat surface that needs a grid overlay. The grid is positioned and oriented
in world space using a Transform.
Usage example:
Transform transform = new Transform(new Point3D(0, 100, 0));
Rectangle rect = new Rectangle(new Point2D(-500, -500), new Point2D(500, 500));
LineAppearance appearance = new LineAppearance(1, Color.GRAY);
Grid2D grid = new Grid2D(transform, rect, 10, 10, appearance);
shapeCollection.addShape(grid);
- See Also:
-
Field Summary
Fields inherited from class AbstractShape
cachedBoundingBox, mouseInteractionController -
Constructor Summary
ConstructorsConstructorDescriptionGrid2D(Transform transform, Rectangle rectangle, int xDivisionCount, int yDivisionCount, LineAppearance appearance) Constructs a 2D grid in the XY plane with the specified dimensions and number of divisions. -
Method Summary
Methods inherited from class 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 AbstractShape
invalidateBounds
-
Constructor Details
-
Grid2D
public Grid2D(Transform transform, Rectangle rectangle, int xDivisionCount, int yDivisionCount, LineAppearance appearance) Constructs a 2D grid in the XY plane with the specified dimensions and number of divisions.- Parameters:
transform- the transform defining the grid's position and orientation in world spacerectangle- the rectangular dimensions of the grid in local XY spacexDivisionCount- the number of divisions (cells) along the X axis; producesxDivisionCount + 1vertical linesyDivisionCount- the number of divisions (cells) along the Y axis; producesyDivisionCount + 1horizontal linesappearance- the line appearance (color, width) used for all grid lines
-