Package raymarcher
Class MeshGroup
java.lang.Object
raymarcher.MeshGroup
- All Implemented Interfaces:
Mesh
public class MeshGroup extends java.lang.Object implements Mesh
A class that allows for seperate meshes and geometry to be combined
into a single mesh using boolean operations, to create more complex
geometry.
Wikipedia Constructive Solid Geometery
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
MeshGroup.IntersectionGroup
An inner class representing a mesh group made with the intersection operationclass
MeshGroup.SubtractGroup
An inner class representing a mesh group made with the subtract operationclass
MeshGroup.UnionGroup
An inner class representing a mesh group made with the union operation -
Field Summary
Fields Modifier and Type Field Description static int
INTERSECTION
The value for a boolean intersection operationprivate java.awt.Color
meshColor
The color of the mesh groupprivate Mesh
meshGroup
The meshgroup created for the given meshesstatic int
SUBTRACT
The value for a boolean subtraction operationstatic int
UNION
The value for a boolean union operation -
Constructor Summary
-
Method Summary
Modifier and Type Method Description java.awt.Color
getMeshColor()
Gives the mesh's colordouble
sdf(Vector3 position)
The signed distance function for the mesh, which tells the mesh's distance to a point in 3D spacevoid
setMeshColor(java.awt.Color meshColor)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
UNION
public static final int UNIONThe value for a boolean union operation- See Also:
- Constant Field Values
-
SUBTRACT
public static final int SUBTRACTThe value for a boolean subtraction operation- See Also:
- Constant Field Values
-
INTERSECTION
public static final int INTERSECTIONThe value for a boolean intersection operation- See Also:
- Constant Field Values
-
meshColor
private java.awt.Color meshColorThe color of the mesh group -
meshGroup
The meshgroup created for the given meshes
-
-
Constructor Details
-
MeshGroup
Creates a mesh group with one of three boolean operations- Parameters:
mesh1
- The first mesh in for the boolean operationmesh2
- The second mesh in for the boolean operationoperation
- The operation used to create the groupmeshColor
- The color of the new mesh group
-
-
Method Details
-
setMeshColor
public void setMeshColor(java.awt.Color meshColor)- Parameters:
meshColor
- the color to set this mesh group to
-
getMeshColor
public java.awt.Color getMeshColor()Description copied from interface:Mesh
Gives the mesh's color- Specified by:
getMeshColor
in interfaceMesh
- Returns:
- The color of the mesh
-
sdf
Description copied from interface:Mesh
The signed distance function for the mesh, which tells the mesh's distance to a point in 3D space- Specified by:
sdf
in interfaceMesh
- Parameters:
position
- The vector representation of the position of the point to measure the distance to- Returns:
- The signed distance of the mesh to the point. Values > 0 indicate the point is outside the mesh, values = 0 are points on the surface, and values < 0 are points inside the mesh.
-