Class Face

java.lang.Object
rayrangers.raytracer.world.Face
All Implemented Interfaces:
Hittable
Direct Known Subclasses:
Triangle

public abstract class Face extends Object implements Hittable
Represents a face described by a Wavefront OBJ file. OBJ file: f v ... f v/vt ... f v//vn f v/vt/vn ...
  • Field Details

    • material

      protected Material material
      Material of the face.
    • smoothingGroup

      protected String smoothingGroup
      Smoothing group the face belongs to. OBJ file: s smoothing-group
  • Constructor Details

    • Face

      public Face(Material material, String smoothingGroup)
      Constructs a face with the given material and smoothing group.
      Parameters:
      material - material
      smoothingGroup - smoothing group, parser will pass Integer.MIN_VALUE if not specified
  • Method Details

    • getMaterial

      public Material getMaterial()
      Returns the material of the face.
      Returns:
      material
    • getSmoothingGroup

      public String getSmoothingGroup()
      Returns the smoothing group of the face.
      Returns:
      smoothing group
    • isInSameSmoothinggroup

      public boolean isInSameSmoothinggroup(Face otherFace)
      Checks if another face is in the same smoothing group.
      Parameters:
      otherFace - face to compare
      Returns:
      boolean result
    • getAllVert

      public abstract Vertex3D[] getAllVert()
      Returns all vertices of the face in an array.
      Returns:
      vertices
    • getCenter

      public abstract Vertex3D getCenter()
      Calculates the center point of a face.
      Returns:
      center point