All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kzc_plane.h File Reference

Plane structure and operations. More...

Classes

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...
 
KANZI_API void kzcPlaneCreateFromPointAndNormal (struct KzcPlane *plane, const struct KzcVector3 *point, const struct KzcVector3 *normal)
 Constructs a plane from point and normal. More...
 
KANZI_API kzFloat kzcPlaneDistanceToPoint (const struct KzcPlane *plane, const struct KzcVector3 *point)
 Gets point's distance to plane. More...
 
KANZI_API 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...
 
KANZI_API void kzcPlaneProjectDirectionVector3 (const struct KzcPlane *plane, const struct KzcVector3 *vector, struct KzcVector3 *out_vector)
 Project a direction vector onto a plane. More...
 
KANZI_API void kzcPlaneProjectPositionVector3 (const struct KzcPlane *plane, const struct KzcVector3 *position, struct KzcVector3 *out_position)
 Project a position vector onto the plane. More...
 
KANZI_API 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-2020 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.

KANZI_API 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.

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

Gets point's distance to plane.

KANZI_API 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.

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

Project a direction vector onto a plane.

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

Project a position vector onto the plane.

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

Outputs plane normal into out_normal.