kzc_ray.hpp File Reference

Ray utility. More...

Classes

struct  KzcRay
 Structure for ray. More...
 

Functions

KZ_INLINE void kzcRaySet (const struct KzcVector3 origin, const struct KzcVector3 direction, struct KzcRay *out_ray)
 Constructs a ray from point and direction vector. More...
 
KANZI_API kzBool kzcRaySphereIntersection (const struct KzcRay *ray, const struct KzcVector3 *spherePosition, const kzFloat sphereRadius, kzFloat *out_distance)
 Test intersection between ray and sphere and return distance. More...
 
KANZI_API kzBool kzcRayBoundingBoxIntersection (const struct KzcRay *ray, const struct KzcVector3 *boundingBoxMinimum, const struct KzcVector3 *boundingBoxMaximum, const struct KzcMatrix4x4 *boxOrientation, kzFloat *out_distance, struct KzcVector3 *out_hitPoint)
 Test intersection between ray and bounding box. More...
 
KANZI_API kzBool kzcRayBoundingBoxBackfaceIntersection (const struct KzcRay *ray, const struct KzcVector3 *boundingBoxMinimum, const struct KzcVector3 *boundingBoxMaximum, const struct KzcMatrix4x4 *boxOrientation, kzFloat *out_distance, struct KzcVector3 *out_hitPoint)
 Test intersection between ray and bounding box back faces. More...
 
KANZI_API kzBool kzcRayCylinderIntersection (const struct KzcRay *ray, kzFloat cylinderRadius, kzFloat cylinderHeight, const struct KzcVector3 *cylinderAxis, const struct KzcMatrix4x4 *cylinderTransform, kzFloat *out_distance)
 Tests intersection between ray and cylinder aligned in the given unit-axis, ranging [-height/2, height/2]. More...
 
KANZI_API void kzcRayTransform (struct KzcRay *ray, const struct KzcMatrix4x4 *transform)
 Transform a ray by a 4x4 matrix. More...
 

Detailed Description

Ray utility.

Copyright 2008-2017 by Rightware. All rights reserved.

Function Documentation

KZ_INLINE void kzcRaySet ( const struct KzcVector3  origin,
const struct KzcVector3  direction,
struct KzcRay out_ray 
)

Constructs a ray from point and direction vector.

Normalizes the direction vector

KANZI_API kzBool kzcRaySphereIntersection ( const struct KzcRay ray,
const struct KzcVector3 spherePosition,
const kzFloat  sphereRadius,
kzFloat out_distance 
)

Test intersection between ray and sphere and return distance.

KANZI_API kzBool kzcRayBoundingBoxIntersection ( const struct KzcRay ray,
const struct KzcVector3 boundingBoxMinimum,
const struct KzcVector3 boundingBoxMaximum,
const struct KzcMatrix4x4 boxOrientation,
kzFloat out_distance,
struct KzcVector3 out_hitPoint 
)

Test intersection between ray and bounding box.

KANZI_API kzBool kzcRayBoundingBoxBackfaceIntersection ( const struct KzcRay ray,
const struct KzcVector3 boundingBoxMinimum,
const struct KzcVector3 boundingBoxMaximum,
const struct KzcMatrix4x4 boxOrientation,
kzFloat out_distance,
struct KzcVector3 out_hitPoint 
)

Test intersection between ray and bounding box back faces.

KANZI_API kzBool kzcRayCylinderIntersection ( const struct KzcRay ray,
kzFloat  cylinderRadius,
kzFloat  cylinderHeight,
const struct KzcVector3 cylinderAxis,
const struct KzcMatrix4x4 cylinderTransform,
kzFloat out_distance 
)

Tests intersection between ray and cylinder aligned in the given unit-axis, ranging [-height/2, height/2].

The cylinder is first transformed with the given transformation matrix.

KANZI_API void kzcRayTransform ( struct KzcRay ray,
const struct KzcMatrix4x4 transform 
)

Transform a ray by a 4x4 matrix.