Struct in ldk_raycast.h

LDKRay

typedef struct LDKRay{
  Vec3 origin;
  Vec3 direction;
}LDKRay;
Struct in ldk_raycast.h

LDKRaycastHit

typedef struct LDKRaycastHit{
  Vec3 position;
  Vec3 normal;
  float distance;
  u32 triangle_index;
}LDKRaycastHit;
Function in ldk_raycast.h

ldk_ray_at

Compute the 3D position along a ray at the specified distance.

LDK_API Vec3 ldk_ray_at(
 LDKRay ray,
 float distance
);

Parameters

LDKRay ray
Ray used by this operation.
float distance
Distance in world-space units.

Returns

The requested value.

Function in ldk_raycast.h

ldk_ray_make

Construct a 3D ray from origin and direction.

LDK_API bool ldk_ray_make(
 Vec3 origin,
 Vec3 direction,
 LDKRay *out_ray
);

Parameters

Vec3 origin
Origin used by this operation.
Vec3 direction
Direction used by this operation.
LDKRay *out_ray
Receives the resulting ray.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_raycast.h

ldk_ray_transform

Transform a ray using a matrix.

LDK_API bool ldk_ray_transform(
 LDKRay ray,
 Mat4 transform,
 LDKRay *out_ray
);

Parameters

LDKRay ray
Ray used by this operation.
Mat4 transform
Transform used by this operation.
LDKRay *out_ray
Receives the resulting ray.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_raycast.h

ldk_raycast_plane

Test the intersection of a ray with a plane.

LDK_API bool ldk_raycast_plane(
 LDKRay ray,
 Vec3 plane_point,
 Vec3 plane_normal,
 LDKRaycastHit *out_hit
);

Parameters

LDKRay ray
Ray used by this operation.
Vec3 plane_point
Plane point used by this operation.
Vec3 plane_normal
Plane normal used by this operation.
LDKRaycastHit *out_hit
Receives the intersection details.

Returns

True if the operation succeeds; false otherwise.

Function in ldk_raycast.h

ldk_raycast_triangle

Test the intersection of a ray with a triangle.

LDK_API bool ldk_raycast_triangle(
 LDKRay ray,
 Vec3 a,
 Vec3 b,
 Vec3 c,
 LDKRaycastHit *out_hit
);

Parameters

LDKRay ray
Ray used by this operation.
Vec3 a
First value to compare or combine.
Vec3 b
Second value to compare or combine.
Vec3 c
C used by this operation.
LDKRaycastHit *out_hit
Receives the intersection details.

Returns

True if the operation succeeds; false otherwise.