-
首页
-
C4D R23.110 C++ SDK
GeRayCollider Class Reference
Library
»
Collider
#include <lib_collider.h>
详细描述
Ray
collider engine : evaluates intersections between a ray and a single polygon object. The polygons are split into two triangles each when calculating the intersections, thus affecting the intersection count when the invisible shared edges are hit. The original polygon object remains unmodified.
-
注意
-
Has to be created with
Alloc()
and destroyed with
Free()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
构造函数 & 析构函数文档编制
◆
GeRayCollider()
◆
~GeRayCollider()
成员函数文档编制
◆
Alloc()
Allocates a ray collider engine. Destroy the allocated ray collider engine with
Free()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
返回
-
The allocated ray collider engine, or
nullptr
if the allocation failed.
◆
Free()
Destructs ray collider engines allocated with
Alloc()
。使用
AutoAlloc
to automate the allocation and destruction based on scope.
-
参数
-
[in,out]
|
data
|
The ray collider engine to destruct. If the pointer is
nullptr
nothing happens. The pointer is assigned
nullptr
afterwards.
|
◆
Init()
Initializes the ray collider with the object specified by
goal
.
-
参数
-
[in]
|
goal
|
The object to check for intersections. The pointed object is copied.
|
[in]
|
force
|
若
false
then
Cinema 4D
checks if the passed object's
GetDirty(DIRTYFLAGS::DATA)
is unchanged. If yes, it does nothing and returns
true
.
若
true
it always rebuilds the cache.
|
-
返回
-
true
if successful, otherwise
false
.
◆
Intersect()
Bool
Intersect
|
(
|
const
向量
&
|
ray_p
,
|
|
|
const
向量
&
|
ray_dir
,
|
|
|
Float
|
ray_length
,
|
|
|
Bool
|
only_test
=
false
|
|
)
|
|
|
Checks if the line segment specified by
ray_p
to
ray_p
+
ray_dir
*
ray_length
intersects the object.
若
only_test
is
false
the intersections can be evaluated with
GetIntersectionCount()
and
GetIntersection()
.
-
参数
-
[in]
|
ray_p
|
The start point of the ray in object coordinates.
|
[in]
|
ray_dir
|
The ray direction in object coordinates.
|
[in]
|
ray_length
|
The ray length.
|
[in]
|
only_test
|
若
true
no information about the intersections are stored, so only the return value can be used to tell if there were intersections or not.
|
-
返回
-
true
if there was an intersection, otherwise
false
.
◆
GetIntersectionCount()
Int32
GetIntersectionCount
|
(
|
|
)
|
|
Retrieves the number of intersections found by
Intersect()
, which is in terms of the amount of triangles hit by the ray. Intersecting a shared edge will result in a value greater than one. Intersecting a shared edge point will result in a value that varies depending on how the polygon object is split up into triangles.
-
返回
-
The number of intersections.
◆
GetIntersection()
Retrieves intersections, found with
Intersect()
, by index.
-
参数
-
-
返回
-
true
if successful, otherwise
false
.
◆
GetNearestIntersection()
Retrieves the intersection, found with
Intersect()
, closest to the start of the ray.
-
参数
-
[in]
|
res
|
Assigned the intersection information. The caller owns the pointed
GeRayColResult
.
|
-
返回
-
true
if successful, otherwise
false
.