java.lang.Object
com.marginallyclever.ro3.apps.pathtracer.PathTriangle
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublegetArea()doublegetCentroidAxis(int axis) Get the centroid of the triangle along a specific axis.getColorAt(javax.vecmath.Point3d point) javax.vecmath.Vector3dgetNormalAt(javax.vecmath.Point3d inside) javax.vecmath.Point3dGet a random point inside the triangle using barycentric coordinates.javax.vecmath.Point2dgetUVAt(javax.vecmath.Point3d point) Get the UV coordinates of the texture at a specific point on the triangle.doubleintersectRay(Ray ray) Test if a ray intersects this triangle.
-
Field Details
-
a
-
b
-
c
-
bounds
-
-
Constructor Details
-
PathTriangle
-
-
Method Details
-
getBounds
-
intersectRay
Test if a ray intersects this triangle.- Parameters:
ray- the ray to test- Returns:
- the distance along the ray to the intersection point, or Double.MAX_VALUE if there is no intersection.
-
getRandomPointInside
public javax.vecmath.Point3d getRandomPointInside()Get a random point inside the triangle using barycentric coordinates.- Returns:
- a random point inside the triangle.
-
getArea
public double getArea() -
getUVAt
public javax.vecmath.Point2d getUVAt(javax.vecmath.Point3d point) Get the UV coordinates of the texture at a specific point on the triangle.- Parameters:
point- the 3d world point of intersection with the triangle.- Returns:
- the UV coordinates of the texture at the point.
-
getColorAt
-
getCentroidAxis
public double getCentroidAxis(int axis) Get the centroid of the triangle along a specific axis.- Parameters:
axis- the axis to get the centroid along (0 for x, 1 for y, or 2 for z)- Returns:
- the centroid coordinate along the specified axis
-
getNormalAt
public javax.vecmath.Vector3d getNormalAt(javax.vecmath.Point3d inside)
-