Package raymarcher.meshes
Class TriangularPrism
java.lang.Object
raymarcher.meshes.TriangularPrism
- All Implemented Interfaces:
- Mesh
public class TriangularPrism extends java.lang.Object implements Mesh
An implementation of the Mesh interface that renders an equilateral triangular prism
- 
Field SummaryFields Modifier and Type Field Description private doubleheightThe height of the triangular prism's traingle baseprivate doublelengthThe length of the prism (distance between bases)private java.awt.ColormeshColorThe color of the meshprivate Vector3positionThe position of the triangular prism
- 
Constructor SummaryConstructors Constructor Description TriangularPrism(Vector3 position, double height, double length, java.awt.Color meshColor)Create a triangular prism mesh
- 
Method SummaryModifier and Type Method Description doublegetHeight()doublegetLength()java.awt.ColorgetMeshColor()Gives the mesh's colorVector3getPosition()doublesdf(Vector3 position)The signed distance function for the mesh, which tells the mesh's distance to a point in 3D spacevoidsetHeight(double height)voidsetLength(double length)voidsetMeshColor(java.awt.Color meshColor)voidsetPosition(Vector3 position)Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
- 
Field Details- 
positionThe position of the triangular prism
- 
heightprivate double heightThe height of the triangular prism's traingle base
- 
lengthprivate double lengthThe length of the prism (distance between bases)
- 
meshColorprivate java.awt.Color meshColorThe color of the mesh
 
- 
- 
Constructor Details- 
TriangularPrismCreate a triangular prism mesh- Parameters:
- position- The position in 3D space to place the prism
- height- The height of the triangular prism's traingle base
- length- The length of the prism
- meshColor- The color of the mesh
 
 
- 
- 
Method Details- 
getPosition- Returns:
- the current position of the center of the mesh
 
- 
setPosition- Parameters:
- position- the new center of the prism
 
- 
getHeightpublic double getHeight()- Returns:
- The current height of the triangular prism's traingle base
 
- 
setHeightpublic void setHeight(double height)- Parameters:
- height- the new height of the triangular prism's traingle base
 
- 
getLengthpublic double getLength()- Returns:
- the prism's current length
 
- 
setLengthpublic void setLength(double length)- Parameters:
- length- the new length for the prism
 
- 
setMeshColorpublic void setMeshColor(java.awt.Color meshColor)- Parameters:
- meshColor- The new color to set the mesh to
 
- 
getMeshColorpublic java.awt.Color getMeshColor()Description copied from interface:MeshGives the mesh's color- Specified by:
- getMeshColorin interface- Mesh
- Returns:
- The color of the mesh
 
- 
sdfDescription copied from interface:MeshThe signed distance function for the mesh, which tells the mesh's distance to a point in 3D space- Specified by:
- sdfin interface- Mesh
- 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.
 
 
-