mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 03:42:50 +08:00
squared distance in comments
Summary: Comments were describing squared distance as absolute distance in a few places. Reviewed By: nikhilaravi Differential Revision: D20426020 fbshipit-source-id: 009946867c4a98f61f5ce7158542d41e22bf8346
This commit is contained in:
parent
d91c1d365b
commit
2361845548
@ -218,14 +218,15 @@ BarycentricPerspectiveCorrectionBackward(
|
||||
return thrust::make_tuple(grad_bary, grad_z0, grad_z1, grad_z2);
|
||||
}
|
||||
|
||||
// Return minimum distance between line segment (v1 - v0) and point p.
|
||||
// Calculate minimum squared distance between a line segment (v1 - v0) and a
|
||||
// point p.
|
||||
//
|
||||
// Args:
|
||||
// p: Coordinates of a point.
|
||||
// v0, v1: Coordinates of the end points of the line segment.
|
||||
//
|
||||
// Returns:
|
||||
// non-square distance to the boundary of the triangle.
|
||||
// squared distance to the boundary of the triangle.
|
||||
//
|
||||
__device__ inline float
|
||||
PointLineDistanceForward(const float2& p, const float2& a, const float2& b) {
|
||||
@ -284,7 +285,7 @@ PointLineDistanceBackward(
|
||||
// v0, v1, v2: Coordinates of the three triangle vertices.
|
||||
//
|
||||
// Returns:
|
||||
// shortest absolute distance from a point to a triangle.
|
||||
// shortest squared distance from a point to a triangle.
|
||||
//
|
||||
__device__ inline float PointTriangleDistanceForward(
|
||||
const float2& p,
|
||||
|
@ -241,14 +241,15 @@ inline std::tuple<vec3<T>, T, T, T> BarycentricPerspectiveCorrectionBackward(
|
||||
return std::make_tuple(grad_bary, grad_z0, grad_z1, grad_z2);
|
||||
}
|
||||
|
||||
// Calculate minimum distance between a line segment (v1 - v0) and point p.
|
||||
// Calculate minimum squared distance between a line segment (v1 - v0) and a
|
||||
// point p.
|
||||
//
|
||||
// Args:
|
||||
// p: Coordinates of a point.
|
||||
// v0, v1: Coordinates of the end points of the line segment.
|
||||
//
|
||||
// Returns:
|
||||
// non-square distance of the point to the line.
|
||||
// squared distance of the point to the line.
|
||||
//
|
||||
// Consider the line extending the segment - this can be parameterized as:
|
||||
// v0 + t (v1 - v0).
|
||||
@ -322,7 +323,7 @@ inline std::tuple<vec2<T>, vec2<T>, vec2<T>> PointLineDistanceBackward(
|
||||
// v0, v1, v2: Coordinates of the three triangle vertices.
|
||||
//
|
||||
// Returns:
|
||||
// shortest absolute distance from a point to a triangle.
|
||||
// shortest squared distance from a point to a triangle.
|
||||
//
|
||||
//
|
||||
template <typename T>
|
||||
|
@ -214,14 +214,15 @@ RasterizeMeshesNaiveCpu(
|
||||
continue; // Point is behind the image plane so ignore.
|
||||
}
|
||||
|
||||
// Compute absolute distance of the point to the triangle.
|
||||
// If the point is inside the triangle then the distance
|
||||
// is negative.
|
||||
// Compute squared distance of the point to the triangle.
|
||||
const float dist = PointTriangleDistanceForward(pxy, v0, v1, v2);
|
||||
|
||||
// Use the bary coordinates to determine if the point is
|
||||
// inside the face.
|
||||
const bool inside = bary.x > 0.0f && bary.y > 0.0f && bary.z > 0.0f;
|
||||
|
||||
// If the point is inside the triangle then signed_dist
|
||||
// is negative.
|
||||
const float signed_dist = inside ? -dist : dist;
|
||||
|
||||
// Check if pixel is outside blur region
|
||||
|
Loading…
x
Reference in New Issue
Block a user