This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm (Experimental)
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine::Geometry Class

Header: #include <UnigineGeometry.h>

This class is used to represent a collection of generic 3d math functions such as line plane intersection, closest points on two lines, etc.

Geometry Class

Members


void getClosestPointOnLine ( const Math::dvec3 & point, const Math::dvec3 & p0, const Math::dvec3 & p1, Math::dvec3 & ret ) #

Scans the specified line segment and searches for the point closest to the reference point. The found point will be put to the return vector.

Arguments

  • const Math::dvec3 & point - Reference point.
  • const Math::dvec3 & p0 - Line start point.
  • const Math::dvec3 & p1 - Line end point.
  • Math::dvec3 & ret - Return vector.

void getClosestPointOnLine ( const Math::vec3 & point, const Math::vec3 & p0, const Math::vec3 & p1, Math::vec3 & ret ) #

Scans the specified line segment and searches for the point closest to the reference point. The found point will be put to the return vector.

Arguments

  • const Math::vec3 & point - Reference point.
  • const Math::vec3 & p0 - Line start point.
  • const Math::vec3 & p1 - Line end point.
  • Math::vec3 & ret - Return vector.

int getClosestPointOnTriangle ( const Math::dvec3 & point, const Math::dvec3 & v0, const Math::dvec3 & v1, const Math::dvec3 & v2, Math::dvec3 & ret ) #

Scans the specified triangle and searches for the point closest to the reference point. The found point will be put to the return vector.

Arguments

  • const Math::dvec3 & point - Reference point.
  • const Math::dvec3 & v0 - The first vertex of the triangle.
  • const Math::dvec3 & v1 - The second vertex of the triangle.
  • const Math::dvec3 & v2 - The third vertex of the triangle.
  • Math::dvec3 & ret - Return vector.

Return value

1 if the point is inside the triangle; otherwise, 0

int getClosestPointOnTriangle ( const Math::vec3 & point, const Math::vec3 & v0, const Math::vec3 & v1, const Math::vec3 & v2, Math::vec3 & ret ) #

Scans the specified triangle and searches for the point closest to the reference point. The found point will be put to the return vector.

Arguments

  • const Math::vec3 & point - Reference point.
  • const Math::vec3 & v0 - The first vertex of the triangle.
  • const Math::vec3 & v1 - The second vertex of the triangle.
  • const Math::vec3 & v2 - The third vertex of the triangle.
  • Math::vec3 & ret - Return vector.

Return value

1 if the point is inside the triangle; otherwise, 0

int getClosestPointsOnLines ( const Math::dvec3 & p00, const Math::dvec3 & p01, const Math::dvec3 & p10, const Math::dvec3 & p11, Math::dvec3 & ret_0, Math::dvec3 & ret_1 ) #

Scans the two specified lines and searches for the pair of closest points. The closest points of the first and the second lines will be put to the respective return vector.

Arguments

  • const Math::dvec3 & p00 - Start point of the first line.
  • const Math::dvec3 & p01 - End point of the first line.
  • const Math::dvec3 & p10 - Start point of the second line.
  • const Math::dvec3 & p11 - End point of the second line.
  • Math::dvec3 & ret_0 - First return vector.
  • Math::dvec3 & ret_1 - Second return vector.

Return value

1 if the lines cross; otherwise, 0

int getClosestPointsOnLines ( const Math::vec3 & p00, const Math::vec3 & p01, const Math::vec3 & p10, const Math::vec3 & p11, Math::vec3 & ret_0, Math::vec3 & ret_1 ) #

Scans the two specified lines and searches for the pair of closest points. The closest points of the first and the second lines will be put to the respective return vectors.

Arguments

  • const Math::vec3 & p00 - Start point of the first line.
  • const Math::vec3 & p01 - End point of the first line.
  • const Math::vec3 & p10 - Start point of the second line.
  • const Math::vec3 & p11 - End point of the second line.
  • Math::vec3 & ret_0 - First return vector.
  • Math::vec3 & ret_1 - Second return vector.

Return value

1 if the lines cross; otherwise, 0

int irayBoundBoxIntersection ( const Math::dvec3 & point, const Math::dvec3 & idirection, const Math::dvec3 & min, const Math::dvec3 & max ) #

Checks if there is an intersection between a ray and a bounding box. The same function as rayBoundBoxIntersection(), but it uses the inverse of the ray direction, which increases performance.

Arguments

  • const Math::dvec3 & point - Starting point of the ray.
  • const Math::dvec3 & idirection - Inverse direction of the ray.
  • const Math::dvec3 & min - Min coordinates of the axis-aligned bounding box.
  • const Math::dvec3 & max - Min coordinates of the axis-aligned bounding box.

Return value

1 if the given ray intersects the given bounding box; otherwise, 0.

int irayBoundBoxIntersection ( const Math::vec3 & point, const Math::vec3 & idirection, const Math::vec3 & min, const Math::vec3 & max ) #

Checks if there is an intersection between a ray and a bounding box. The same function as rayBoundBoxIntersection(), but it uses the inverse of the ray direction, which increases performance.

Arguments

  • const Math::vec3 & point - Starting point of the ray.
  • const Math::vec3 & idirection - Inverse direction of the ray.
  • const Math::vec3 & min - Min coordinates of the axis-aligned bounding box.
  • const Math::vec3 & max - Max coordinates of the axis-aligned bounding box.

Return value

1 if the given ray intersects the given bounding box; otherwise, 0.

int linePlaneIntersection ( const Math::vec3 & p0, const Math::vec3 & p1, const Math::vec4 & plane ) #

Checks if there is an intersection between a line and a plane.

Arguments

  • const Math::vec3 & p0 - Start point of the line.
  • const Math::vec3 & p1 - End point of the line.
  • const Math::vec4 & plane - Plane.

Return value

1 if the given line intersects the given plane; otherwise, 0.

int linePlaneIntersection ( const Math::vec3 & p0, const Math::vec3 & p1, const Math::vec3 & plane_point, const Math::vec3 & plane_normal, Math::vec3 & ret ) #

Calculates the intersection of a line and a plane. If the function returns 1, the point of intersection will be put to the return vector.

Arguments

  • const Math::vec3 & p0 - Start point of the line.
  • const Math::vec3 & p1 - End point of the line.
  • const Math::vec3 & plane_point - Point of the plane.
  • const Math::vec3 & plane_normal - Normal to the plane.
  • Math::vec3 & ret - Return vector.

Return value

1 if the given line intersects the given plane; otherwise, 0.

int linePlaneIntersection ( const Math::dvec3 & p0, const Math::dvec3 & p1, const Math::dvec3 & plane_point, const Math::dvec3 & plane_normal ) #

Checks if there is an intersection between a line and a plane.

Arguments

  • const Math::dvec3 & p0 - Start point of the line.
  • const Math::dvec3 & p1 - Start point of the line.
  • const Math::dvec3 & plane_point - Point of the plane.
  • const Math::dvec3 & plane_normal - Normal to the plane.

Return value

1 if the given line intersects the given plane; otherwise, 0.

int linePlaneIntersection ( const Math::dvec3 & p0, const Math::dvec3 & p1, const Math::dvec3 & plane_point, const Math::dvec3 & plane_normal, Math::dvec3 & ret ) #

Calculates the intersection of a line and a plane. If the function returns 1, the point of intersection will be put to the return vector.

Arguments

  • const Math::dvec3 & p0 - Start point of the line.
  • const Math::dvec3 & p1 - End point of the line.
  • const Math::dvec3 & plane_point - Point of the plane.
  • const Math::dvec3 & plane_normal - Normal to the plane.
  • Math::dvec3 & ret - Return vector.

Return value

1 if the given line intersects the given plane; otherwise, 0.

int linePlaneIntersection ( const Math::vec3 & p0, const Math::vec3 & p1, const Math::vec3 & plane_point, const Math::vec3 & plane_normal ) #

Checks if there is an intersection between a line and a plane.

Arguments

  • const Math::vec3 & p0 - Start point of the line.
  • const Math::vec3 & p1 - End point of the line.
  • const Math::vec3 & plane_point - Point of the plane.
  • const Math::vec3 & plane_normal - Normal to the plane.

Return value

1 if the given line intersects the given plane; otherwise, 0.

int linePlaneIntersection ( const Math::dvec3 & p0, const Math::dvec3 & p1, const Math::dvec4 & plane, Math::dvec3 & ret ) #

Calculates the intersection of a line and a plane. If the function returns 1, the point of intersection will be put to the return vector.

Arguments

  • const Math::dvec3 & p0 - Start point of the line.
  • const Math::dvec3 & p1 - End point of the line.
  • const Math::dvec4 & plane - Plane.
  • Math::dvec3 & ret - Return vector.

Return value

1 if the given line intersects the given plane; otherwise, 0.

int linePlaneIntersection ( const Math::vec3 & p0, const Math::vec3 & p1, const Math::vec4 & plane, Math::vec3 & ret ) #

Calculates the intersection of a line and a plane. If the function returns 1, the point of intersection will be put to the return vector.

Arguments

  • const Math::vec3 & p0 - Start point of the line.
  • const Math::vec3 & p1 - End point of the line.
  • const Math::vec4 & plane - Plane.
  • Math::vec3 & ret - Return vector.

Return value

1 if the given line intersects the given plane; otherwise, 0.

int linePlaneIntersection ( const Math::dvec3 & p0, const Math::dvec3 & p1, const Math::dvec4 & plane ) #

Checks if there is an intersection between a line and a plane.

Arguments

  • const Math::dvec3 & p0 - Start point of the line.
  • const Math::dvec3 & p1 - End point of the line.
  • const Math::dvec4 & plane - Plane.

Return value

1 if the given line intersects the given plane; otherwise, 0.

float normalizeAngle ( float angle ) #

Normalizes the angle in [-180, 180 ] range.

Arguments

  • float angle - Input angle.

Return value

Normalized angle, in degrees.

void orthoBasis ( const Math::vec3 & v, Math::vec3 & tangent, Math::vec3 & binormal ) #

Creates an ortho transformation. Output tangent and binormal vectors will be put to corresponding return vector.

Arguments

  • const Math::vec3 & v - Input vector.
  • Math::vec3 & tangent - Return vector.
  • Math::vec3 & binormal - Return vector.

void orthoBasis ( const Math::dvec3 & v, Math::dvec3 & tangent, Math::dvec3 & binormal ) #

Creates an ortho transformation. Output tangent and binormal vectors will be put to corresponding return vectors.

Arguments

  • const Math::dvec3 & v - Input vector.
  • Math::dvec3 & tangent - Return vector.
  • Math::dvec3 & binormal - Return vector.

Math::quat orthoTangent ( const Math::vec3 & tangent, const Math::vec3 & binormal, const Math::vec3 & normal ) #

Creates the ortho triangle tangent space basis.

Arguments

  • const Math::vec3 & tangent - Tangent vector.
  • const Math::vec3 & binormal - Binormal vector.
  • const Math::vec3 & normal - Normal vector.

Return value

Tangent basis.

Math::quat orthoTangent ( const Math::vec4 & tangent, const Math::vec3 & normal ) #

Creates the ortho triangle tangent space basis.

Arguments

  • const Math::vec4 & tangent - Tangent vector.
  • const Math::vec3 & normal - Normal vector.

Return value

Tangent basis.

void orthoTransform ( const Math::dvec3 & v, Math::dmat4 & transform ) #

Creates an ortho transformation. The transformation will be put to the return matrix.

Arguments

  • const Math::dvec3 & v - Input vector.
  • Math::dmat4 & transform - Return matrix.

void orthoTransform ( const Math::vec3 & v, Math::mat4 & transform ) #

Creates an ortho transformation. The transformation will be put to the return matrix.

Arguments

  • const Math::vec3 & v - Input vector.
  • Math::mat4 & transform - Return matrix.

float pointPolygonDistance ( const Math::vec3 & point, const Math::vec3 * vertex, int[] indices, const Math::vec4 & plane ) #

Returns the distance from a point to a polygon.

Arguments

  • const Math::vec3 & point - Point.
  • const Math::vec3 * vertex - Pointer to vertex structure.
  • int[] indices - Array of vertex indices.
  • const Math::vec4 & plane - Polygon plane.

Return value

Distance.

double pointPolygonDistance ( const Math::dvec3 & point, const Math::dvec3 * vertex, int[] indices, const Math::dvec4 & plane ) #

Returns the distance from a point to a polygon.

Arguments

  • const Math::dvec3 & point - Point.
  • const Math::dvec3 * vertex - Pointer to vertex structure.
  • int[] indices - Array of vertex indices.
  • const Math::dvec4 & plane - Polygon plane.

Return value

Distance.

int pointPolygonInside ( const Math::vec3 & point, const Math::vec3 * vertex, int[] indices, const Math::vec3 & normal ) #

Checks if a point is inside a polygon.

Arguments

  • const Math::vec3 & point - Point.
  • const Math::vec3 * vertex - Pointer to vertex structure.
  • int[] indices - Array of vertex indices.
  • const Math::vec3 & normal - Normal to the polygon plane.

Return value

1 if the point is inside the given polygon; otherwise, 0.

int pointPolygonInside ( const Math::dvec3 & point, const Math::dvec3 * vertex, int[] indices, const Math::dvec3 & normal ) #

Checks if a point is inside a polygon.

Arguments

  • const Math::dvec3 & point - Point.
  • const Math::dvec3 * vertex - Pointer to vertex structure.
  • int[] indices - Array of vertex indices.
  • const Math::dvec3 & normal - Normal to the polygon plane.

Return value

1 if the point is inside the given polygon; otherwise, 0.

void pointTriangleCoordinates ( const Math::vec3 & point, const Math::vec3 & v0, const Math::vec3 & v1, const Math::vec3 & v2, float & a, float & b ) #

Calculates barycentric triangle coordinates. The coordinates will be put to corresponding return variables.

Arguments

  • const Math::vec3 & point - Point.
  • const Math::vec3 & v0 - The first vertex of the triangle.
  • const Math::vec3 & v1 - The second vertex of the triangle.
  • const Math::vec3 & v2 - The third vertex of the triangle.
  • float & a - Return variable.
  • float & b - Return variable.

void pointTriangleCoordinates ( const Math::dvec3 & point, const Math::dvec3 & v0, const Math::dvec3 & v1, const Math::dvec3 & v2, double & a, double & b ) #

Calculates barycentric triangle coordinates. The coordinates will be put to corresponding return variables.

Arguments

  • const Math::dvec3 & point - Point.
  • const Math::dvec3 & v0 - The first vertex of the triangle.
  • const Math::dvec3 & v1 - The second vertex of the triangle.
  • const Math::dvec3 & v2 - The third vertex of the triangle.
  • double & a - Return variable.
  • double & b - Return variable.

double pointTriangleDistance ( const Math::dvec3 & point, const Math::dvec3 & v0, const Math::dvec3 & v1, const Math::dvec3 & v2, const Math::dvec4 & plane ) #

Returns the closest distance from a point to a triangle.

Arguments

  • const Math::dvec3 & point - Point.
  • const Math::dvec3 & v0 - The first vertex of the triangle.
  • const Math::dvec3 & v1 - The second vertex of the triangle.
  • const Math::dvec3 & v2 - The third vertex of the triangle.
  • const Math::dvec4 & plane - Triangle plane.

Return value

Distance.

float pointTriangleDistance ( const Math::vec3 & point, const Math::vec3 & v0, const Math::vec3 & v1, const Math::vec3 & v2, const Math::vec4 & plane ) #

Returns the closest distance from a point to a triangle.

Arguments

  • const Math::vec3 & point - Point.
  • const Math::vec3 & v0 - The first vertex of the triangle.
  • const Math::vec3 & v1 - The second vertex of the triangle.
  • const Math::vec3 & v2 - The third vertex of the triangle.
  • const Math::vec4 & plane - Triangle plane.

Return value

Distance.

int pointTriangleInside ( const Math::vec3 & point, const Math::vec3 & v0, const Math::vec3 & v1, const Math::vec3 & v2, const Math::vec3 & normal ) #

Checks if a point is inside a triangle.

Arguments

  • const Math::vec3 & point - Point.
  • const Math::vec3 & v0 - The first vertex of the triangle.
  • const Math::vec3 & v1 - The second vertex of the triangle.
  • const Math::vec3 & v2 - The third vertex of the triangle.
  • const Math::vec3 & normal - Normal to the triangle plane.

Return value

1 if the point is inside the given triangle; otherwise, 0.

int pointTriangleInside ( const Math::dvec3 & point, const Math::dvec3 & v0, const Math::dvec3 & v1, const Math::dvec3 & v2, const Math::dvec3 & normal ) #

Checks if a point is inside a triangle.

Arguments

  • const Math::dvec3 & point - Point.
  • const Math::dvec3 & v0 - The first vertex of the triangle.
  • const Math::dvec3 & v1 - The second vertex of the triangle.
  • const Math::dvec3 & v2 - The third vertex of the triangle.
  • const Math::dvec3 & normal - Normal to the triangle plane.

Return value

1 if the point is inside the given triangle; otherwise, 0.

int pointTriangleInside ( const Math::dvec3 & point, const Math::dvec3 & v0, const Math::dvec3 & v1, const Math::dvec3 & v2 ) #

Checks if a point is inside a triangle.

Arguments

  • const Math::dvec3 & point - Point.
  • const Math::dvec3 & v0 - The first vertex of the triangle.
  • const Math::dvec3 & v1 - The second vertex of the triangle.
  • const Math::dvec3 & v2 - The third vertex of the triangle.

Return value

1 if the point is inside the given triangle; otherwise, 0.

int pointTriangleInside ( const Math::vec3 & point, const Math::vec3 & v0, const Math::vec3 & v1, const Math::vec3 & v2 ) #

Checks if a point is inside a triangle.

Arguments

  • const Math::vec3 & point - Point.
  • const Math::vec3 & v0 - The first vertex of the triangle.
  • const Math::vec3 & v1 - The second vertex of the triangle.
  • const Math::vec3 & v2 - The third vertex of the triangle.

Return value

1 if the point is inside the given triangle; otherwise, 0.

Math::vec4 polygonPlane ( const Math::vec3 * vertex, int[] indices ) #

Returns the polygon plane.

Arguments

  • const Math::vec3 * vertex - Pointer to vertex structure.
  • int[] indices - Array of vertex indices.

Return value

Polygon plane.

Math::dvec4 polygonPlane ( const Math::dvec3 * vertex, int[] indices ) #

Returns the polygon plane.

Arguments

  • const Math::dvec3 * vertex - Pointer to vertex structure.
  • int[] indices - Array of vertex indices.

Return value

Polygon plane.

Math::vec3 projectOntoPlane ( const Math::vec3 & v, const Math::vec3 & plane_normal ) #

Calculates the projection of a vector onto a given plane.

Arguments

  • const Math::vec3 & v - Input vector.
  • const Math::vec3 & plane_normal - Normal to the plane.

Return value

Projection of the input vector onto the plane.

Math::dvec3 projectOntoPlane ( const Math::dvec3 & v, const Math::dvec3 & plane_normal ) #

Calculates the projection of a vector onto a given plane.

Arguments

  • const Math::dvec3 & v - Input vector.
  • const Math::dvec3 & plane_normal - Normal to the plane.

Return value

Projection of the input vector onto the plane.

int rayBoundBoxIntersection ( const Math::dvec3 & point, const Math::dvec3 & direction, const Math::dvec3 & min, const Math::dvec3 & max ) #

Checks if a ray intersects a bounding box. The same function as irayBoundBoxIntersection(), but the latter has higher performance due to reduction of division operations, as the ray direction is replaced by the pre-calculated inverse of the ray direction.

Arguments

  • const Math::dvec3 & point - Starting point of the ray.
  • const Math::dvec3 & direction - Direction of the ray.
  • const Math::dvec3 & min - Min coordinates of the axis-aligned bounding box.
  • const Math::dvec3 & max - Max coordinates of the axis-aligned bounding box.

Return value

1 if the given ray intersects the given bounding box; otherwise, 0.

int rayBoundBoxIntersection ( const Math::vec3 & point, const Math::vec3 & direction, const Math::vec3 & min, const Math::vec3 & max ) #

Checks if a ray intersects a bounding box. The same function as irayBoundBoxIntersection(), but the latter has higher performance due to reduction of division operations, as the ray direction is replaced by the pre-calculated inverse of the ray direction.

Arguments

  • const Math::vec3 & point - Starting point of the ray.
  • const Math::vec3 & direction - Direction of the ray.
  • const Math::vec3 & min - Min coordinates of the axis-aligned bounding box.
  • const Math::vec3 & max - Max coordinates of the axis-aligned bounding box.

Return value

1 if the given ray intersects the given bounding box; otherwise, 0.

int rayPlaneIntersection ( const Math::vec3 & point, const Math::vec3 & direction, const Math::vec4 & plane ) #

Checks if a ray intersects a plane.

Arguments

  • const Math::vec3 & point - Starting point of the ray.
  • const Math::vec3 & direction - Direction of the ray.
  • const Math::vec4 & plane - Plane.

Return value

1 if the given ray intersects the given plane; otherwise, 0.

int rayPlaneIntersection ( const Math::vec3 & point, const Math::vec3 & direction, const Math::vec3 & plane_point, const Math::vec3 & plane_normal ) #

Checks if a ray intersects a plane.

Arguments

  • const Math::vec3 & point - Starting point of the ray.
  • const Math::vec3 & direction - Direction of the ray.
  • const Math::vec3 & plane_point - Point on the plane.
  • const Math::vec3 & plane_normal - Normal to the plane.

Return value

1 if the given ray intersects the given plane; otherwise, 0.

int rayPlaneIntersection ( const Math::dvec3 & point, const Math::dvec3 & direction, const Math::dvec4 & plane, Math::dvec3 & ret ) #

Calculates the intersection of a ray and a plane. If the function returns 1, the point of intersection will be put to the return vector.

Arguments

  • const Math::dvec3 & point - Starting point of the ray.
  • const Math::dvec3 & direction - Direction of the ray.
  • const Math::dvec4 & plane - Plane.
  • Math::dvec3 & ret - Return vector.

Return value

1 if the given ray intersects the given plane; otherwise, 0.

int rayPlaneIntersection ( const Math::vec3 & point, const Math::vec3 & direction, const Math::vec3 & plane_point, const Math::vec3 & plane_normal, Math::vec3 & ret ) #

Calculates the intersection of a ray and a plane. If the function returns 1, the point of intersection will be put to the return vector.

Arguments

  • const Math::vec3 & point - Starting point of the ray.
  • const Math::vec3 & direction - Direction of the ray.
  • const Math::vec3 & plane_point - Point on the plane.
  • const Math::vec3 & plane_normal - Normal to the plane.
  • Math::vec3 & ret - Return vector.

Return value

1 if the given ray intersects the given plane; otherwise, 0.

int rayPlaneIntersection ( const Math::vec3 & point, const Math::vec3 & direction, const Math::vec4 & plane, Math::vec3 & ret ) #

Calculates the intersection of a ray and a plane. If the function returns 1, the point of intersection will be put to the return vector.

Arguments

  • const Math::vec3 & point - Starting point of the ray.
  • const Math::vec3 & direction - Direction of the ray.
  • const Math::vec4 & plane - Plane.
  • Math::vec3 & ret - Return vector.

Return value

1 if the given ray intersects the given plane; otherwise, 0.

int rayPlaneIntersection ( const Math::dvec3 & point, const Math::dvec3 & direction, const Math::dvec3 & plane_point, const Math::dvec3 & plane_normal ) #

Checks if a ray intersects a plane.

Arguments

  • const Math::dvec3 & point - Starting point of the ray.
  • const Math::dvec3 & direction - Direction of the ray.
  • const Math::dvec3 & plane_point - Point on the plane.
  • const Math::dvec3 & plane_normal - Normal to the plane.

Return value

1 if the given ray intersects the given plane; otherwise, 0.

int rayPlaneIntersection ( const Math::dvec3 & point, const Math::dvec3 & direction, const Math::dvec3 & plane_point, const Math::dvec3 & plane_normal, Math::dvec3 & ret ) #

Calculates the intersection of a ray and a plane. If the function returns 1, the point of intersection will be put to the return vector.

Arguments

  • const Math::dvec3 & point - Starting point of the ray.
  • const Math::dvec3 & direction - Direction of the ray.
  • const Math::dvec3 & plane_point - Point on the plane.
  • const Math::dvec3 & plane_normal - Normal to the plane.
  • Math::dvec3 & ret - Return vector.

Return value

1 if the given ray intersects the given plane; otherwise, 0.

int rayPlaneIntersection ( const Math::dvec3 & point, const Math::dvec3 & direction, const Math::dvec4 & plane ) #

Checks if a ray intersects a plane.

Arguments

  • const Math::dvec3 & point - Starting point of the ray.
  • const Math::dvec3 & direction - Direction of the ray.
  • const Math::dvec4 & plane - Plane.

Return value

1 if the given ray intersects the given plane; otherwise, 0.

int rayTriangleIntersection ( const Math::vec3 & point, const Math::vec3 & direction, const Math::vec3 & v0, const Math::vec3 & v1, const Math::vec3 & v2 ) #

Checks if a ray intersects a triangle.

Arguments

  • const Math::vec3 & point - Starting point of the ray.
  • const Math::vec3 & direction - Direction of the ray.
  • const Math::vec3 & v0 - The first triangle vertex.
  • const Math::vec3 & v1 - The second triangle vertex.
  • const Math::vec3 & v2 - The third triangle vertex.

Return value

1 if the given ray intersects the given triangle; otherwise, 0.

int rayTriangleIntersection ( const Math::dvec3 & point, const Math::dvec3 & direction, const Math::dvec3 & v0, const Math::dvec3 & v1, const Math::dvec3 & v2 ) #

Checks if a ray intersects a triangle.

Arguments

  • const Math::dvec3 & point - Starting point of the ray.
  • const Math::dvec3 & direction - Direction of the ray.
  • const Math::dvec3 & v0 - The first triangle vertex.
  • const Math::dvec3 & v1 - The second triangle vertex.
  • const Math::dvec3 & v2 - The third triangle vertex.

Return value

1 if the given ray intersects the given triangle; otherwise, 0.

int segmentPlaneIntersection ( const Math::vec3 & p0, const Math::vec3 & p1, const Math::vec4 & plane, Math::vec3 & ret ) #

Calculates the intersection of a segment and a plane. If the function returns 1, the point of intersection will be put to the return vector.

Arguments

  • const Math::vec3 & p0 - Start point of the line segment.
  • const Math::vec3 & p1 - End point of the line segment.
  • const Math::vec4 & plane - Plane.
  • Math::vec3 & ret - Return vector.

Return value

1 if the given ray intersects the given triangle; otherwise, 0.

int segmentPlaneIntersection ( const Math::vec3 & p0, const Math::vec3 & p1, const Math::vec3 & plane_point, const Math::vec3 & plane_normal ) #

Checks if a segment intersects a plane.

Arguments

  • const Math::vec3 & p0 - Start point of the line segment.
  • const Math::vec3 & p1 - End point of the line segment.
  • const Math::vec3 & plane_point - Point on the plane.
  • const Math::vec3 & plane_normal - Normal to the plane.

Return value

1 if the given segment intersects the given plane; otherwise, 0.

int segmentPlaneIntersection ( const Math::vec3 & p0, const Math::vec3 & p1, const Math::vec4 & plane ) #

Checks if a segment intersects a plane.

Arguments

  • const Math::vec3 & p0 - Start point of the line segment.
  • const Math::vec3 & p1 - End point of the line segment.
  • const Math::vec4 & plane - Plane.

Return value

1 if the given segment intersects the given plane; otherwise, 0.

int segmentPlaneIntersection ( const Math::vec3 & p0, const Math::vec3 & p1, const Math::vec3 & plane_point, const Math::vec3 & plane_normal, Math::vec3 & ret ) #

Calculates the intersection of a line segment and a plane. If the function returns 1, the point of intersection will be put to the return vector.

Arguments

  • const Math::vec3 & p0 - Start point of the line segment.
  • const Math::vec3 & p1 - End point of the line segment.
  • const Math::vec3 & plane_point - Point on the plane.
  • const Math::vec3 & plane_normal - Normal to the plane.
  • Math::vec3 & ret - Return vector.

Return value

1 if the given segment intersects the given plane; otherwise, 0.

int segmentPlaneIntersection ( const Math::dvec3 & p0, const Math::dvec3 & p1, const Math::dvec4 & plane ) #

Checks if a segment intersects a plane.

Arguments

  • const Math::dvec3 & p0 - Start point of the line segment.
  • const Math::dvec3 & p1 - End point of the line segment.
  • const Math::dvec4 & plane - Plane.

Return value

1 if the given segment intersects the given plane; otherwise, 0.

int segmentPlaneIntersection ( const Math::dvec3 & p0, const Math::dvec3 & p1, const Math::dvec3 & plane_point, const Math::dvec3 & plane_normal ) #

Checks if a segment intersects a plane.

Arguments

  • const Math::dvec3 & p0 - Start point of the line segment.
  • const Math::dvec3 & p1 - End point of the line segment.
  • const Math::dvec3 & plane_point - Point on the plane.
  • const Math::dvec3 & plane_normal - Normal to the plane.

Return value

1 if the given segment intersects the given plane; otherwise, 0.

int segmentPlaneIntersection ( const Math::dvec3 & p0, const Math::dvec3 & p1, const Math::dvec4 & plane, Math::dvec3 & ret ) #

Calculates the intersection of a line segment and a plane. If the function returns 1, the point of intersection will be put to the return vector.

Arguments

  • const Math::dvec3 & p0 - Start point of the line segment.
  • const Math::dvec3 & p1 - End point of the line segment.
  • const Math::dvec4 & plane - Plane.
  • Math::dvec3 & ret - Return vector.

Return value

1 if the given segment intersects the given plane; otherwise, 0.

int segmentPlaneIntersection ( const Math::dvec3 & p0, const Math::dvec3 & p1, const Math::dvec3 & plane_point, const Math::dvec3 & plane_normal, Math::dvec3 & ret ) #

Calculates the intersection of a line segment and a plane. If the function returns 1, the point of intersection will be put to the return vector.

Arguments

  • const Math::dvec3 & p0 - Start point of the line segment.
  • const Math::dvec3 & p1 - End point of the line segment.
  • const Math::dvec3 & plane_point - Point on the plane.
  • const Math::dvec3 & plane_normal - Normal to the plane.
  • Math::dvec3 & ret - Return vector.

Return value

1 if the given segment intersects the given plane; otherwise, 0.

double triangleArea ( const Math::dvec3 & v0, const Math::dvec3 & v1, const Math::dvec3 & v2 ) #

Returns the triangle area.

Arguments

  • const Math::dvec3 & v0 - The first triangle vertex.
  • const Math::dvec3 & v1 - The second triangle vertex.
  • const Math::dvec3 & v2 - The third triangle vertex.

Return value

Triangle area.

float triangleArea ( const Math::vec3 & v0, const Math::vec3 & v1, const Math::vec3 & v2 ) #

Returns the triangle area.

Arguments

  • const Math::vec3 & v0 - The first triangle vertex.
  • const Math::vec3 & v1 - The second triangle vertex.
  • const Math::vec3 & v2 - The third triangle vertex.

Return value

Triangle area.

Math::dvec3 triangleNormal ( const Math::dvec3 & v0, const Math::dvec3 & v1, const Math::dvec3 & v2 ) #

Returns the triangle normal vector.

Arguments

  • const Math::dvec3 & v0 - The first triangle vertex.
  • const Math::dvec3 & v1 - The second triangle vertex.
  • const Math::dvec3 & v2 - The third triangle vertex.

Return value

Triangle normal vector.

Math::vec3 triangleNormal ( const Math::vec3 & v0, const Math::vec3 & v1, const Math::vec3 & v2 ) #

Returns the triangle normal vector.

Arguments

  • const Math::vec3 & v0 - The first triangle vertex.
  • const Math::vec3 & v1 - The second triangle vertex.
  • const Math::vec3 & v2 - The third triangle vertex.

Return value

Triangle normal vector.

Math::vec4 trianglePlane ( const Math::vec3 & v0, const Math::vec3 & v1, const Math::vec3 & v2 ) #

Returns the triangle plane.

Arguments

  • const Math::vec3 & v0 - The first triangle vertex.
  • const Math::vec3 & v1 - The second triangle vertex.
  • const Math::vec3 & v2 - The third triangle vertex.

Return value

Triangle plane.

Math::dvec4 trianglePlane ( const Math::dvec3 & v0, const Math::dvec3 & v1, const Math::dvec3 & v2 ) #

Returns the triangle plane.

Arguments

  • const Math::dvec3 & v0 - The first triangle vertex.
  • const Math::dvec3 & v1 - The second triangle vertex.
  • const Math::dvec3 & v2 - The third triangle vertex.

Return value

Triangle plane.

Math::vec4 triangleTangent ( const Math::vec3 & v0, const Math::vec3 & v1, const Math::vec3 & v2, const Math::vec2 & t0, const Math::vec2 & t1, const Math::vec2 & t2 ) #

Returns the triangle tangent space.

Arguments

  • const Math::vec3 & v0 - The first triangle vertex.
  • const Math::vec3 & v1 - The second triangle vertex.
  • const Math::vec3 & v2 - The third triangle vertex.
  • const Math::vec2 & t0 - Tangent vector of the first triangle vertex.
  • const Math::vec2 & t1 - Tangent vector of the second triangle vertex.
  • const Math::vec2 & t2 - Tangent vector of the third triangle vertex.

Return value

Triangle tangent space vector.

Math::vec4 triangleTangent ( const Math::vec3 & v0, const Math::vec3 & v1, const Math::vec3 & v2, const Math::vec2 & t0, const Math::vec2 & t1, const Math::vec2 & t2, const Math::vec3 & normal ) #

Returns the triangle tangent space.

Arguments

  • const Math::vec3 & v0 - The first triangle vertex.
  • const Math::vec3 & v1 - The second triangle vertex.
  • const Math::vec3 & v2 - The third triangle vertex.
  • const Math::vec2 & t0 - Tangent vector of the first triangle vertex.
  • const Math::vec2 & t1 - Tangent vector of the second triangle vertex.
  • const Math::vec2 & t2 - Tangent vector of the third triangle vertex.
  • const Math::vec3 & normal - Normal.

Return value

Triangle tangent space vector.

Math::vec4 triangleTangent ( const Math::vec3 & v0, const Math::vec3 & v1, const Math::vec3 & v2 ) #

Returns the triangle tangent space.

Arguments

  • const Math::vec3 & v0 - The first triangle vertex.
  • const Math::vec3 & v1 - The second triangle vertex.
  • const Math::vec3 & v2 - The third triangle vertex.

Return value

Triangle tangent space vector.
Last update: 2020-11-24
Build: ()