HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_IntersectionAnalysis Class Reference

#include <GU_IntersectionAnalysis.h>

Classes

struct  SegmentIntersectionInfo
 
struct  TriangleIntersectionInfo
 

Public Types

enum  SegmentIntersectionType { SEGMENT_INTERIOR = 0, SEGMENT_VERTEX, SEGMENT_SEGMENT }
 Where on a segment does the intersection lie. More...
 
enum  TriangleIntersectionType { TRIANGLE_INTERIOR = 0, TRIANGLE_EDGE, TRIANGLE_VERTEX, TRIANGLE_SEGMENT }
 Where on the triangle does the intersection lie. More...
 
using Real = fpreal64
 Shorthands for common vector types. More...
 
using Vec3 = UT_Vector3T< Real >
 
using Vec3f = UT_Vector3T< fpreal32 >
 
using Vec2 = UT_Vector2T< Real >
 
using Vec4 = UT_Vector4T< Real >
 

Static Public Member Functions

static UT_Optional< std::pair
< SegmentIntersectionInfo,
TriangleIntersectionInfo > > 
triangleSegmentIntersect (const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &n, const Vec3 &a, const Vec3 &b)
 
template<bool USEFILTER>
static UT_Optional< std::pair
< SegmentIntersectionInfo,
TriangleIntersectionInfo > > 
triangleSegmentIntersect (const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &n, const Vec3 &a, const Vec3 &b, const UT_GeometryPredicates< Real, USEFILTER > &pred)
 
static UT_Optional< std::pair
< SegmentIntersectionInfo,
SegmentIntersectionInfo > > 
segmentSegmentIntersect (const Vec3 &p0, const Vec3 &p1, const Vec3 &q0, const Vec3 &q1)
 
template<bool USEFILTER>
static UT_Optional< std::pair
< SegmentIntersectionInfo,
SegmentIntersectionInfo > > 
segmentSegmentIntersect (const Vec3 &p0, const Vec3 &p1, const Vec3 &q0, const Vec3 &q1, const UT_GeometryPredicates< Real, USEFILTER > &pred)
 
static UT_Optional< std::pair
< SegmentIntersectionInfo,
SegmentIntersectionInfo > > 
segmentSegmentIntersect (const Vec3 &p0, const Vec3 &p1, const Vec3 &q0, const Vec3 &q1, Real tol)
 
template<bool USEFILTER>
static UT_Optional< std::pair
< SegmentIntersectionInfo,
SegmentIntersectionInfo > > 
segmentSegmentIntersect (const Vec3 &p0, const Vec3 &p1, const Vec3 &q0, const Vec3 &q1, Real tol, const UT_GeometryPredicates< Real, USEFILTER > &pred)
 
static UT_Vector3DArray findIntersectionPoints (const GEO_Detail *gdp0, const GA_PrimitiveGroup *prim_grp0, const GEO_Detail *gdp1=NULL, const GA_PrimitiveGroup *prim_grp1=NULL, Real prox_tol=0, UT_Array< UT_Int32Array > *input_num_arr=NULL, UT_Array< UT_Int64Array > *prim_num_arr=NULL, UT_Array< UT_Fpreal32Array > *prim_uvw_arr=NULL, UT_Array< UT_Int64Array > *pt_num_arr=NULL)
 
static UT_UniquePtr< GU_DetailvalidateGeometry (const GU_Detail *geo, std::string &warning)
 

Detailed Description

Definition at line 21 of file GU_IntersectionAnalysis.h.

Member Typedef Documentation

Shorthands for common vector types.

Definition at line 25 of file GU_IntersectionAnalysis.h.

Member Enumeration Documentation

Where on a segment does the intersection lie.

Supporting data structures specifying the information about triangle and segment intersections

Enumerator
SEGMENT_INTERIOR 
SEGMENT_VERTEX 
SEGMENT_SEGMENT 

Definition at line 35 of file GU_IntersectionAnalysis.h.

Where on the triangle does the intersection lie.

Enumerator
TRIANGLE_INTERIOR 
TRIANGLE_EDGE 
TRIANGLE_VERTEX 
TRIANGLE_SEGMENT 

Definition at line 61 of file GU_IntersectionAnalysis.h.

Member Function Documentation

static UT_Vector3DArray GU_IntersectionAnalysis::findIntersectionPoints ( const GEO_Detail gdp0,
const GA_PrimitiveGroup prim_grp0,
const GEO_Detail gdp1 = NULL,
const GA_PrimitiveGroup prim_grp1 = NULL,
Real  prox_tol = 0,
UT_Array< UT_Int32Array > *  input_num_arr = NULL,
UT_Array< UT_Int64Array > *  prim_num_arr = NULL,
UT_Array< UT_Fpreal32Array > *  prim_uvw_arr = NULL,
UT_Array< UT_Int64Array > *  pt_num_arr = NULL 
)
static

Given valid details gdp0 and gdp1, returns points of intersection between the two details or self-intersection if gdp1 is null. This routine requires a valid gdp containing triangles and curves only, as ensured by validateGeometry

static UT_Optional< std::pair<SegmentIntersectionInfo, SegmentIntersectionInfo> > GU_IntersectionAnalysis::segmentSegmentIntersect ( const Vec3 p0,
const Vec3 p1,
const Vec3 q0,
const Vec3 q1 
)
static

PRE: Two segments p0-p1 and q0-q1. Assume that all points are distinct. POST: Find t coordinates for the two segments respectively if the intersection is close to endpoints p0,p1,q0,q1 then these will be accordinly snapped to 0 or 1 so you can test them against 1 and 0 later with operator==

template<bool USEFILTER>
static UT_Optional< std::pair<SegmentIntersectionInfo, SegmentIntersectionInfo> > GU_IntersectionAnalysis::segmentSegmentIntersect ( const Vec3 p0,
const Vec3 p1,
const Vec3 q0,
const Vec3 q1,
const UT_GeometryPredicates< Real, USEFILTER > &  pred 
)
static
static UT_Optional< std::pair<SegmentIntersectionInfo, SegmentIntersectionInfo> > GU_IntersectionAnalysis::segmentSegmentIntersect ( const Vec3 p0,
const Vec3 p1,
const Vec3 q0,
const Vec3 q1,
Real  tol 
)
static

Approximate version of the function above. tol is the distance tolerance between line segments. If tol == 0, this function simply calls the function above

template<bool USEFILTER>
static UT_Optional< std::pair<SegmentIntersectionInfo, SegmentIntersectionInfo> > GU_IntersectionAnalysis::segmentSegmentIntersect ( const Vec3 p0,
const Vec3 p1,
const Vec3 q0,
const Vec3 q1,
Real  tol,
const UT_GeometryPredicates< Real, USEFILTER > &  pred 
)
static
static UT_Optional<std::pair<SegmentIntersectionInfo, TriangleIntersectionInfo> > GU_IntersectionAnalysis::triangleSegmentIntersect ( const Vec3 p0,
const Vec3 p1,
const Vec3 p2,
const Vec3 n,
const Vec3 a,
const Vec3 b 
)
static

This routine computes the intersection between a segment and a triangle. PRE: p0,p1,p2 are triangle vertex positions n is the triangle normal ( e.g. cross(p1-p0, p2-p0).normalize() ) a,b are segment vertex positions Assume that all points are distinct. POST: Returns the intersection info as defined above. This method guarantees that the local primitive 1-u-v,u,v, coordinates are in the triangle interior (i.e. no coordinate is exactly 0 or 1) if intersection type is TRIANGLE_INTERIOR. Naturally, one of 1-u-v,u,v is zero if the type is TRIANGLE_EDGE, and two are 0 if type is TRIANGLE_VERTEX.

template<bool USEFILTER>
static UT_Optional<std::pair<SegmentIntersectionInfo, TriangleIntersectionInfo> > GU_IntersectionAnalysis::triangleSegmentIntersect ( const Vec3 p0,
const Vec3 p1,
const Vec3 p2,
const Vec3 n,
const Vec3 a,
const Vec3 b,
const UT_GeometryPredicates< Real, USEFILTER > &  pred 
)
static
static UT_UniquePtr<GU_Detail> GU_IntersectionAnalysis::validateGeometry ( const GU_Detail geo,
std::string warning 
)
static

Returns a shared pointer to a GU_Detail containing validated geometry from the given input GU_Detail. A warning message is provided if the input detail needed significant changes for validation. This routine insures that the detail passed into findIntersectionPoints is valid.


The documentation for this class was generated from the following file: