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 operation
    class  MeshGroup.SubtractGroup
    An inner class representing a mesh group made with the subtract operation
    class  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 operation
    private java.awt.Color meshColor
    The color of the mesh group
    private Mesh meshGroup
    The meshgroup created for the given meshes
    static int SUBTRACT
    The value for a boolean subtraction operation
    static int UNION
    The value for a boolean union operation
  • Constructor Summary

    Constructors
    Constructor Description
    MeshGroup​(Mesh mesh1, Mesh mesh2, int operation, java.awt.Color meshColor)
    Creates a mesh group with one of three boolean operations
  • Method Summary

    Modifier and Type Method Description
    java.awt.Color getMeshColor()
    Gives the mesh's color
    double sdf​(Vector3 position)
    The signed distance function for the mesh, which tells the mesh's distance to a point in 3D space
    void 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 UNION
      The value for a boolean union operation
      See Also:
      Constant Field Values
    • SUBTRACT

      public static final int SUBTRACT
      The value for a boolean subtraction operation
      See Also:
      Constant Field Values
    • INTERSECTION

      public static final int INTERSECTION
      The value for a boolean intersection operation
      See Also:
      Constant Field Values
    • meshColor

      private java.awt.Color meshColor
      The color of the mesh group
    • meshGroup

      private Mesh meshGroup
      The meshgroup created for the given meshes
  • Constructor Details

    • MeshGroup

      public MeshGroup​(Mesh mesh1, Mesh mesh2, int operation, java.awt.Color meshColor)
      Creates a mesh group with one of three boolean operations
      Parameters:
      mesh1 - The first mesh in for the boolean operation
      mesh2 - The second mesh in for the boolean operation
      operation - The operation used to create the group
      meshColor - 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 interface Mesh
      Returns:
      The color of the mesh
    • sdf

      public double sdf​(Vector3 position)
      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 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.