Kanzi Graphics Engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
kzc_plane.h File Reference

Plane structure and operations. More...

Data Structures

struct  KzcPlane
 Structure for a plane. More...
 

Functions

KZ_INLINE struct KzcPlane kzcPlane (kzFloat x, kzFloat y, kzFloat z, kzFloat negativeDistance)
 Creates a plane structure from a point (x,y,z) on the plane and negative distance from origin. More...
 
void kzcPlaneCreateFromPointAndNormal (struct KzcPlane *plane, const struct KzcVector3 *point, const struct KzcVector3 *normal)
 Constructs a plane from point and normal. More...
 
kzFloat kzcPlaneDistanceToPoint (const struct KzcPlane *plane, const struct KzcVector3 *point)
 Gets point's distance to plane. More...
 
kzBool kzcPlaneRayIntersection (const struct KzcPlane *plane, const struct KzcRay *ray, kzFloat parallelTolerance, kzFloat *out_distance, struct KzcVector3 *out_intersectionPoint)
 Gets ray and plane intersection point. More...
 
void kzcPlaneProjectDirectionVector3 (const struct KzcPlane *plane, const struct KzcVector3 *vector, struct KzcVector3 *out_vector)
 Project a direction vector onto a plane. More...
 
void kzcPlaneProjectPositionVector3 (const struct KzcPlane *plane, const struct KzcVector3 *position, struct KzcVector3 *out_position)
 Project a position vector onto the plane. More...
 
void kzcPlaneGetNormal (const struct KzcPlane *plane, struct KzcVector3 *out_normal)
 Outputs plane normal into out_normal. More...
 

Detailed Description

Plane structure and operations.

Copyright 2008-2019 by Rightware. All rights reserved.

Function Documentation

KZ_INLINE struct KzcPlane kzcPlane ( kzFloat  x,
kzFloat  y,
kzFloat  z,
kzFloat  negativeDistance 
)

Creates a plane structure from a point (x,y,z) on the plane and negative distance from origin.

void kzcPlaneCreateFromPointAndNormal ( struct KzcPlane plane,
const struct KzcVector3 point,
const struct KzcVector3 normal 
)

Constructs a plane from point and normal.

The normal must be of unit length.

kzFloat kzcPlaneDistanceToPoint ( const struct KzcPlane plane,
const struct KzcVector3 point 
)

Gets point's distance to plane.

kzBool kzcPlaneRayIntersection ( const struct KzcPlane plane,
const struct KzcRay ray,
kzFloat  parallelTolerance,
kzFloat out_distance,
struct KzcVector3 out_intersectionPoint 
)

Gets ray and plane intersection point.

The plane and the ray are tested for parallelness using the tolerance value. If the tolerance test does not pass, output values are filled with NaNs and KZ_FALSE is returned.

void kzcPlaneProjectDirectionVector3 ( const struct KzcPlane plane,
const struct KzcVector3 vector,
struct KzcVector3 out_vector 
)

Project a direction vector onto a plane.

void kzcPlaneProjectPositionVector3 ( const struct KzcPlane plane,
const struct KzcVector3 position,
struct KzcVector3 out_position 
)

Project a position vector onto the plane.

void kzcPlaneGetNormal ( const struct KzcPlane plane,
struct KzcVector3 out_normal 
)

Outputs plane normal into out_normal.