Module raytracer

Class SubPatch

java.lang.Object
de.grogra.ray2.radiosity.SubPatch
All Implemented Interfaces:
Mesh

public class SubPatch extends Object implements Mesh
This class describes a patch containing a triangle.
Author:
Ralf Kopsch
  • Constructor Details

    • SubPatch

      public SubPatch(Vector3d a, Vector3d b, Vector3d c)
      Constructor, creates a new SubPatch.
      Parameters:
      a - vertice 1
      b - vertice 2
      c - vertice 3
    • SubPatch

      public SubPatch(SubPatch in)
      Copy Constructor
      Parameters:
      in - the SubPatch to copy.
  • Method Details

    • getFFMap

      public Map<SubPatch,FormFactor> getFFMap()
      Returns the form factor map.
      Returns:
      Returns the form factor map.
    • clearFFMap

      public void clearFFMap()
      Clears the form factor map.
    • setRadiosity

      public void setRadiosity(Color3f col)
      Sets the radiosity color.
      Parameters:
      col - the radiosity color to set.
    • setRadiosity

      public void setRadiosity(float x, float y, float z)
      Sets the radiosity color.
      Parameters:
      x - the x-value.
      y - the y-value.
      z - the z-value.
    • getRadiosity

      public Color3f getRadiosity()
      Returns the radiosity color.
      Returns:
      Returns the radiosity color.
    • set

      public void set(Vector3d a, Vector3d b, Vector3d c)
      Sets the vertices for this patch.
      Parameters:
      a - vertice 1
      b - vertice 2
      c - vertice 3
    • getCenter

      public Vector3d getCenter()
      Return the center of this patch.
      Returns:
      Return the center of this patch.
    • getNormal

      public Vector3d getNormal()
      Returns the normal vector of this patch.
      Returns:
      Returns the normal vector of this patch.
    • isTriangle

      public boolean isTriangle()
      Returns true.
      Returns:
    • getVertices

      public Vector3d[] getVertices()
      Returns an array of vertices.
      Returns:
      Returns an array of vertices.
    • move

      public void move(Vector3d deltaVert)
      Moves the patch along the given vector.
      Parameters:
      deltaVert - the move vector.
    • rotateX

      public void rotateX(double thetaX)
      Rotates the patch around the x-axis.
      Parameters:
      thetaX - the rotation angle.
    • rotateY

      public void rotateY(double thetaY)
      Rotates the patch around the y-axis.
      Parameters:
      thetaY - the rotation angle.
    • rotateZ

      public void rotateZ(double thetaZ)
      Rotates the patch around the z-axis.
      Parameters:
      thetaZ - the rotation angle.
    • getMaxRadDifference

      public float getMaxRadDifference(SubPatch other)
      Returns the maximum difference of radiosity color.
      Parameters:
      other - another patch.
      Returns:
      Returns the maximum difference of radiosity color.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createMesh

      public MyMeshVolume createMesh()
      Converts this patch into a mesh.
      Returns:
      Converts this patch into a mesh.
    • ffMapContains

      public boolean ffMapContains(List<SubPatch> deprecatedPatches)
      Checks whether, the list of deprecated patches contains this patch.
      Parameters:
      deprecatedPatches - the list of deprecated patches.
      Returns:
    • getMaxEdgeCount

      public int getMaxEdgeCount()
      Description copied from interface: Mesh
      Returns the maximum number of edges of a single polygon of the mesh.
      Specified by:
      getMaxEdgeCount in interface Mesh
      Returns:
      maximum number of edges
    • getNormal

      public void getNormal(int index, Tuple3d out)
      Description copied from interface: Mesh
      Gets the normal vector of normal index. The normal vector is not necessarily normalized.
      Specified by:
      getNormal in interface Mesh
      Parameters:
      index - normal number
      out - normal vector will be placed in here
    • getNormalCount

      public int getNormalCount()
      Description copied from interface: Mesh
      Returns the number of normals of the mesh.
      Specified by:
      getNormalCount in interface Mesh
      Returns:
      number of normals
    • getPolygon

      public int getPolygon(int index, int[] indicesOut, int[] normalsOut)
      Description copied from interface: Mesh
      Writes the vertex indices of polygon index to indicesOut and the normal indices to normalsOut and returns the number of vertices of the polygon. If the mesh is closed (see Mesh.isClosed()), inside and outside are determined by the ordering of the vertices: when seen from the outside, vertices have to be oriented in a counter-clockwise manner. Then also the normal vectors have to point to the outside.
      Specified by:
      getPolygon in interface Mesh
      Parameters:
      index - polygon number
      indicesOut - the vertex indices will be placed in here
      normalsOut - the normal indices will be placed in here
      Returns:
      number of vertex indices of polygon
    • getPolygonCount

      public int getPolygonCount()
      Description copied from interface: Mesh
      Returns the number of polygons of the mesh.
      Specified by:
      getPolygonCount in interface Mesh
      Returns:
      number of polygons
    • getUV

      public void getUV(int index, Tuple2d out)
      Description copied from interface: Mesh
      Gets the uv coordinates of vertex index.
      Specified by:
      getUV in interface Mesh
      Parameters:
      index - vertex number
      out - uv coordinates will be placed in here
    • getVertex

      public void getVertex(int index, Tuple3d out)
      Description copied from interface: Mesh
      Gets the spatial vertex coordinates of vertex index.
      Specified by:
      getVertex in interface Mesh
      Parameters:
      index - vertex number
      out - vertex coordinates will be placed in here
    • getVertexCount

      public int getVertexCount()
      Description copied from interface: Mesh
      Returns the number of vertices of the mesh.
      Specified by:
      getVertexCount in interface Mesh
      Returns:
      number of vertices
    • isPolygonPlanar

      public boolean isPolygonPlanar(int index)
      Description copied from interface: Mesh
      Returns true iff the polygon number index is planar.
      Specified by:
      isPolygonPlanar in interface Mesh
      Parameters:
      index - polygon number
      Returns:
      is polygon planar?
    • isClosed

      public boolean isClosed()
      Description copied from interface: Mesh
      Indicates whether this mesh is a closed surface or not. If it is closed, normal vectors have to point to the exterior.
      Specified by:
      isClosed in interface Mesh
      Returns:
      is surface closed?