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

3-dimensional volume. More...

Classes

struct  KzcVolume
 Structure for volume. More...
 

Functions

KZ_INLINE struct KzcVolume kzcVolume (kzFloat x, kzFloat y, kzFloat z, kzFloat width, kzFloat height, kzFloat depth)
 Creates a volume from a point (x,y) and size (width,height). More...
 
KZ_INLINE struct KzcVolume kzcVolumeFromPoints (kzFloat x1, kzFloat x2, kzFloat y1, kzFloat y2, kzFloat z1, kzFloat z2)
 Creates a volume from two points defining arbitrary opposite corners. More...
 
KZ_INLINE struct KzcVolume kzcVolumeFromVectors (const struct KzcVector3 *point1, const struct KzcVector3 *point2)
 Creates a volume from two points defining arbitrary opposite corners. More...
 
KZ_INLINE struct KzcVolume kzcVolumeFromVectorAndSize (const struct KzcVector3 *point, const struct KzcVector3 *size)
 Creates a volume from a point vector and size vector. More...
 
KZ_INLINE kzBool kzcVolumeIsEmpty (const struct KzcVolume *volume)
 Checks if the volume is empty. More...
 
KZ_INLINE kzBool kzcVolumeContainsPoint (const struct KzcVolume *volume, const struct KzcVector3 *point)
 Checks if the given point is inside the given volume. More...
 
KZ_INLINE kzBool kzcVolumeContainsVolume (const struct KzcVolume *volume, const struct KzcVolume *otherVolume)
 Checks if the given volume contains the given other volume completely. More...
 
KZ_INLINE kzBool kzcVolumeOverlaps (const struct KzcVolume *volume1, const struct KzcVolume *volume2)
 Checks if the two given volumes overlap at least partially. More...
 
KZ_INLINE kzBool kzcVolumeIsEqual (const struct KzcVolume *volume1, const struct KzcVolume *volume2)
 Checks if the two given volumes are same. More...
 
KZ_INLINE void kzcVolumeUnion (const struct KzcVolume *volume1, const struct KzcVolume *volume2, struct KzcVolume *targetVolume)
 Calculates bound volume for union of two volumes. More...
 
KZ_INLINE void kzcVolumeIntersection (const struct KzcVolume *volume1, const struct KzcVolume *volume2, struct KzcVolume *targetVolume)
 Calculates intersection of two volumes. More...
 
KZ_INLINE kzFloat kzcVolumeGetVolume (const struct KzcVolume *volume)
 Calculates the area of a volume. More...
 
KZ_INLINE void kzcVolumeTranslate (struct KzcVolume *volume, const struct KzcVector3 *translation)
 Translates a volume. More...
 

Variables

const struct KzcVolume KZC_VOLUME_EMPTY
 Constant zero volume in origin. More...
 
const struct KzcVolume KZC_VOLUME_INFINITE
 Constant for volume which has its minimum as infinite and maximum as negative infinite. More...
 

Detailed Description

3-dimensional volume.

The volume sizes remain non-negative for all operations as long as the input sizes are non-negative.

Copyright 2008-2020 by Rightware. All rights reserved.

Function Documentation

KZ_INLINE struct KzcVolume kzcVolume ( kzFloat  x,
kzFloat  y,
kzFloat  z,
kzFloat  width,
kzFloat  height,
kzFloat  depth 
)

Creates a volume from a point (x,y) and size (width,height).

KZ_INLINE struct KzcVolume kzcVolumeFromPoints ( kzFloat  x1,
kzFloat  x2,
kzFloat  y1,
kzFloat  y2,
kzFloat  z1,
kzFloat  z2 
)

Creates a volume from two points defining arbitrary opposite corners.

KZ_INLINE struct KzcVolume kzcVolumeFromVectors ( const struct KzcVector3 point1,
const struct KzcVector3 point2 
)

Creates a volume from two points defining arbitrary opposite corners.

KZ_INLINE struct KzcVolume kzcVolumeFromVectorAndSize ( const struct KzcVector3 point,
const struct KzcVector3 size 
)

Creates a volume from a point vector and size vector.

KZ_INLINE kzBool kzcVolumeIsEmpty ( const struct KzcVolume volume)

Checks if the volume is empty.

KZ_INLINE kzBool kzcVolumeContainsPoint ( const struct KzcVolume volume,
const struct KzcVector3 point 
)

Checks if the given point is inside the given volume.

The volume is closed from left/right but open from right/bottom.

KZ_INLINE kzBool kzcVolumeContainsVolume ( const struct KzcVolume volume,
const struct KzcVolume otherVolume 
)

Checks if the given volume contains the given other volume completely.

KZ_INLINE kzBool kzcVolumeOverlaps ( const struct KzcVolume volume1,
const struct KzcVolume volume2 
)

Checks if the two given volumes overlap at least partially.

KZ_INLINE kzBool kzcVolumeIsEqual ( const struct KzcVolume volume1,
const struct KzcVolume volume2 
)

Checks if the two given volumes are same.

KZ_INLINE void kzcVolumeUnion ( const struct KzcVolume volume1,
const struct KzcVolume volume2,
struct KzcVolume targetVolume 
)

Calculates bound volume for union of two volumes.

KZ_INLINE void kzcVolumeIntersection ( const struct KzcVolume volume1,
const struct KzcVolume volume2,
struct KzcVolume targetVolume 
)

Calculates intersection of two volumes.

KZ_INLINE kzFloat kzcVolumeGetVolume ( const struct KzcVolume volume)

Calculates the area of a volume.

KZ_INLINE void kzcVolumeTranslate ( struct KzcVolume volume,
const struct KzcVector3 translation 
)

Translates a volume.

Variable Documentation

const struct KzcVolume KZC_VOLUME_EMPTY

Constant zero volume in origin.

const struct KzcVolume KZC_VOLUME_INFINITE

Constant for volume which has its minimum as infinite and maximum as negative infinite.