This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client 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

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(dvec3 point, dvec3 p0, dvec3 p1, out 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 array.

Arguments

  • dvec3 point - Reference point.
  • dvec3 p0 - Line start point.
  • dvec3 p1 - Line end point.
  • out dvec3 ret - Return array.

void getClosestPointOnLine(vec3 point, vec3 p0, vec3 p1, out 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 array.

Arguments

  • vec3 point - Reference point.
  • vec3 p0 - Line start point.
  • vec3 p1 - Line end point.
  • out vec3 ret - Return array.

int getClosestPointOnTriangle(dvec3 point, dvec3 v0, dvec3 v1, dvec3 v2, out 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 array.

Arguments

  • dvec3 point - Reference point.
  • dvec3 v0 - The first vertex of the triangle.
  • dvec3 v1 - The second vertex of the triangle.
  • dvec3 v2 - The third vertex of the triangle.
  • out dvec3 ret - Return array.

Return value

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

int getClosestPointOnTriangle(vec3 point, vec3 v0, vec3 v1, vec3 v2, out 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 array.

Arguments

  • vec3 point - Reference point.
  • vec3 v0 - The first vertex of the triangle.
  • vec3 v1 - The second vertex of the triangle.
  • vec3 v2 - The third vertex of the triangle.
  • out vec3 ret - Return array.

Return value

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

int getClosestPointsOnLines(dvec3 p00, dvec3 p01, dvec3 p10, dvec3 p11, out dvec3 ret_0, out 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 arrays.

Arguments

  • dvec3 p00 - Start point of the first line.
  • dvec3 p01 - End point of the first line.
  • dvec3 p10 - Start point of the second line.
  • dvec3 p11 - End point of the second line.
  • out dvec3 ret_0 - First return array.
  • out dvec3 ret_1 - Second return array.

Return value

1 if the lines cross; otherwise, 0

int getClosestPointsOnLines(vec3 p00, vec3 p01, vec3 p10, vec3 p11, out vec3 ret_0, out 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 arrays.

Arguments

  • vec3 p00 - Start point of the first line.
  • vec3 p01 - End point of the first line.
  • vec3 p10 - Start point of the second line.
  • vec3 p11 - End point of the second line.
  • out vec3 ret_0 - First return array.
  • out vec3 ret_1 - Second return array.

Return value

1 if the lines cross; otherwise, 0

int irayBoundBoxIntersection(dvec3 point, dvec3 idirection, dvec3 min, 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

  • dvec3 point - Starting point of the ray.
  • dvec3 idirection - Inverse direction of the ray.
  • dvec3 min - Min coordinates of the axis-aligned bounding box.
  • 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(vec3 point, vec3 idirection, vec3 min, 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

  • vec3 point - Starting point of the ray.
  • vec3 idirection - Inverse direction of the ray.
  • vec3 min - Min coordinates of the axis-aligned bounding box.
  • 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(vec3 p0, vec3 p1, vec4 plane)

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

Arguments

  • vec3 p0 - Start point of the line.
  • vec3 p1 - End point of the line.
  • vec4 plane - Plane.

Return value

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

int linePlaneIntersection(vec3 p0, vec3 p1, vec3 plane_point, vec3 plane_normal, out 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 array.

Arguments

  • vec3 p0 - Start point of the line.
  • vec3 p1 - End point of the line.
  • vec3 plane_point - Point of the plane.
  • vec3 plane_normal - Normal to the plane.
  • out vec3 ret - Return array.

Return value

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

int linePlaneIntersection(dvec3 p0, dvec3 p1, dvec3 plane_point, dvec3 plane_normal)

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

Arguments

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

Return value

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

int linePlaneIntersection(dvec3 p0, dvec3 p1, dvec3 plane_point, dvec3 plane_normal, out 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 array.

Arguments

  • dvec3 p0 - Start point of the line.
  • dvec3 p1 - End point of the line.
  • dvec3 plane_point - Point of the plane.
  • dvec3 plane_normal - Normal to the plane.
  • out dvec3 ret - Return array.

Return value

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

int linePlaneIntersection(vec3 p0, vec3 p1, vec3 plane_point, vec3 plane_normal)

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

Arguments

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

Return value

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

int linePlaneIntersection(dvec3 p0, dvec3 p1, dvec4 plane, out 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 array.

Arguments

  • dvec3 p0 - Start point of the line.
  • dvec3 p1 - End point of the line.
  • dvec4 plane - Plane.
  • out dvec3 ret - Return array.

Return value

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

int linePlaneIntersection(vec3 p0, vec3 p1, vec4 plane, out 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 array.

Arguments

  • vec3 p0 - Start point of the line.
  • vec3 p1 - End point of the line.
  • vec4 plane - Plane.
  • out vec3 ret - Return array.

Return value

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

int linePlaneIntersection(dvec3 p0, dvec3 p1, dvec4 plane)

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

Arguments

  • dvec3 p0 - Start point of the line.
  • dvec3 p1 - End point of the line.
  • 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(vec3 v, out vec3 tangent, out vec3 binormal)

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

Arguments

  • vec3 v - Input vector.
  • out vec3 tangent - Return array.
  • out vec3 binormal - Return array.

void orthoBasis(dvec3 v, out dvec3 tangent, out dvec3 binormal)

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

Arguments

  • dvec3 v - Input vector.
  • out dvec3 tangent - Return array.
  • out dvec3 binormal - Return array.

quat orthoTangent(vec3 tangent, vec3 binormal, vec3 normal)

Creates the ortho triangle tangent space basis.

Arguments

  • vec3 tangent - Tangent vector.
  • vec3 binormal - Binormal vector.
  • vec3 normal - Normal vector.

Return value

Tangent basis.

quat orthoTangent(vec4 tangent, vec3 normal)

Creates the ortho triangle tangent space basis.

Arguments

  • vec4 tangent - Tangent vector.
  • vec3 normal - Normal vector.

Return value

Tangent basis.

void orthoTransform(dvec3 v, out dmat4 transform)

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

Arguments

  • dvec3 v - Input vector.
  • out dmat4 transform - Return array.

void orthoTransform(vec3 v, out mat4 transform)

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

Arguments

  • vec3 v - Input vector.
  • out mat4 transform - Return array.

float pointPolygonDistance(vec3 point, vec3[] vertex, int[] indices, vec4 plane)

Returns the distance from a point to a polygon.

Arguments

  • vec3 point - Point.
  • vec3[] vertex - Pointer to vertex structure.
  • int[] indices - Array of vertex indices.
  • vec4 plane - Polygon plane.

Return value

Distance.

double pointPolygonDistance(dvec3 point, dvec3[] vertex, int[] indices, dvec4 plane)

Returns the distance from a point to a polygon.

Arguments

  • dvec3 point - Point.
  • dvec3[] vertex - Pointer to vertex structure.
  • int[] indices - Array of vertex indices.
  • dvec4 plane - Polygon plane.

Return value

Distance.

int pointPolygonInside(vec3 point, vec3[] vertex, int[] indices, vec3 normal)

Checks if a point is inside a polygon.

Arguments

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

Return value

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

int pointPolygonInside(dvec3 point, dvec3[] vertex, int[] indices, dvec3 normal)

Checks if a point is inside a polygon.

Arguments

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

Return value

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

void pointTriangleCoordinates(vec3 point, vec3 v0, vec3 v1, vec3 v2, out float a, out float b)

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

Arguments

  • vec3 point - Point.
  • vec3 v0 - The first vertex of the triangle.
  • vec3 v1 - The second vertex of the triangle.
  • vec3 v2 - The third vertex of the triangle.
  • out float a - Return array.
  • out float b - Return array.

void pointTriangleCoordinates(dvec3 point, dvec3 v0, dvec3 v1, dvec3 v2, out double a, out double b)

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

Arguments

  • dvec3 point - Point.
  • dvec3 v0 - The first vertex of the triangle.
  • dvec3 v1 - The second vertex of the triangle.
  • dvec3 v2 - The third vertex of the triangle.
  • out double a - Return array.
  • out double b - Return array.

double pointTriangleDistance(dvec3 point, dvec3 v0, dvec3 v1, dvec3 v2, dvec4 plane)

Returns the closest distance from a point to a triangle.

Arguments

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

Return value

Distance.

float pointTriangleDistance(vec3 point, vec3 v0, vec3 v1, vec3 v2, vec4 plane)

Returns the closest distance from a point to a triangle.

Arguments

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

Return value

Distance.

int pointTriangleInside(vec3 point, vec3 v0, vec3 v1, vec3 v2, vec3 normal)

Checks if a point is inside a triangle.

Arguments

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

Return value

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

int pointTriangleInside(dvec3 point, dvec3 v0, dvec3 v1, dvec3 v2, dvec3 normal)

Checks if a point is inside a triangle.

Arguments

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

Return value

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

int pointTriangleInside(dvec3 point, dvec3 v0, dvec3 v1, dvec3 v2)

Checks if a point is inside a triangle.

Arguments

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

Return value

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

int pointTriangleInside(vec3 point, vec3 v0, vec3 v1, vec3 v2)

Checks if a point is inside a triangle.

Arguments

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

Return value

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

vec4 polygonPlane(vec3[] vertex, int[] indices)

Returns the polygon plane.

Arguments

  • vec3[] vertex - Pointer to vertex structure.
  • int[] indices - Array of vertex indices.

Return value

Polygon plane.

dvec4 polygonPlane(dvec3[] vertex, int[] indices)

Returns the polygon plane.

Arguments

  • dvec3[] vertex - Pointer to vertex structure.
  • int[] indices - Array of vertex indices.

Return value

Polygon plane.

vec3 projectOntoPlane(vec3 v, vec3 plane_normal)

Calculates the projection of a vector onto a given plane.

Arguments

  • vec3 v - Input vector.
  • vec3 plane_normal - Normal to the plane.

Return value

Projection of the input vector onto the plane.

dvec3 projectOntoPlane(dvec3 v, dvec3 plane_normal)

Calculates the projection of a vector onto a given plane.

Arguments

  • dvec3 v - Input vector.
  • dvec3 plane_normal - Normal to the plane.

Return value

Projection of the input vector onto the plane.

int rayBoundBoxIntersection(dvec3 point, dvec3 direction, dvec3 min, 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

  • dvec3 point - Starting point of the ray.
  • dvec3 direction - Direction of the ray.
  • dvec3 min - Min coordinates of the axis-aligned bounding box.
  • 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(vec3 point, vec3 direction, vec3 min, 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

  • vec3 point - Starting point of the ray.
  • vec3 direction - Direction of the ray.
  • vec3 min - Min coordinates of the axis-aligned bounding box.
  • 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(vec3 point, vec3 direction, vec4 plane)

Checks if a ray intersects a plane.

Arguments

  • vec3 point - Starting point of the ray.
  • vec3 direction - Direction of the ray.
  • vec4 plane - Plane.

Return value

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

int rayPlaneIntersection(vec3 point, vec3 direction, vec3 plane_point, vec3 plane_normal)

Checks if a ray intersects a plane.

Arguments

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

Return value

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

int rayPlaneIntersection(dvec3 point, dvec3 direction, dvec4 plane, out 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 array.

Arguments

  • dvec3 point - Starting point of the ray.
  • dvec3 direction - Direction of the ray.
  • dvec4 plane - Plane.
  • out dvec3 ret - Return array.

Return value

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

int rayPlaneIntersection(vec3 point, vec3 direction, vec3 plane_point, vec3 plane_normal, out 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 array.

Arguments

  • vec3 point - Starting point of the ray.
  • vec3 direction - Direction of the ray.
  • vec3 plane_point - Point on the plane.
  • vec3 plane_normal - Normal to the plane.
  • out vec3 ret - Return array.

Return value

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

int rayPlaneIntersection(vec3 point, vec3 direction, vec4 plane, out 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 array.

Arguments

  • vec3 point - Starting point of the ray.
  • vec3 direction - Direction of the ray.
  • vec4 plane - Plane.
  • out vec3 ret - Return array.

Return value

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

int rayPlaneIntersection(dvec3 point, dvec3 direction, dvec3 plane_point, dvec3 plane_normal)

Checks if a ray intersects a plane.

Arguments

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

Return value

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

int rayPlaneIntersection(dvec3 point, dvec3 direction, dvec3 plane_point, dvec3 plane_normal, out 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 array.

Arguments

  • dvec3 point - Starting point of the ray.
  • dvec3 direction - Direction of the ray.
  • dvec3 plane_point - Point on the plane.
  • dvec3 plane_normal - Normal to the plane.
  • out dvec3 ret - Return array.

Return value

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

int rayPlaneIntersection(dvec3 point, dvec3 direction, dvec4 plane)

Checks if a ray intersects a plane.

Arguments

  • dvec3 point - Starting point of the ray.
  • dvec3 direction - Direction of the ray.
  • dvec4 plane - Plane.

Return value

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

int rayTriangleIntersection(vec3 point, vec3 direction, vec3 v0, vec3 v1, vec3 v2)

Checks if a ray intersects a triangle.

Arguments

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

Return value

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

int rayTriangleIntersection(dvec3 point, dvec3 direction, dvec3 v0, dvec3 v1, dvec3 v2)

Checks if a ray intersects a triangle.

Arguments

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

Return value

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

int segmentPlaneIntersection(vec3 p0, vec3 p1, vec4 plane, out 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 array.

Arguments

  • vec3 p0 - Start point of the line segment.
  • vec3 p1 - End point of the line segment.
  • vec4 plane - Plane.
  • out vec3 ret - Return array.

Return value

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

int segmentPlaneIntersection(vec3 p0, vec3 p1, vec3 plane_point, vec3 plane_normal)

Checks if a segment intersects a plane.

Arguments

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

Return value

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

int segmentPlaneIntersection(vec3 p0, vec3 p1, vec4 plane)

Checks if a segment intersects a plane.

Arguments

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

Return value

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

int segmentPlaneIntersection(vec3 p0, vec3 p1, vec3 plane_point, vec3 plane_normal, out 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 array.

Arguments

  • vec3 p0 - Start point of the line segment.
  • vec3 p1 - End point of the line segment.
  • vec3 plane_point - Point on the plane.
  • vec3 plane_normal - Normal to the plane.
  • out vec3 ret - Return array.

Return value

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

int segmentPlaneIntersection(dvec3 p0, dvec3 p1, dvec4 plane)

Checks if a segment intersects a plane.

Arguments

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

Return value

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

int segmentPlaneIntersection(dvec3 p0, dvec3 p1, dvec3 plane_point, dvec3 plane_normal)

Checks if a segment intersects a plane.

Arguments

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

Return value

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

int segmentPlaneIntersection(dvec3 p0, dvec3 p1, dvec4 plane, out 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 array.

Arguments

  • dvec3 p0 - Start point of the line segment.
  • dvec3 p1 - End point of the line segment.
  • dvec4 plane - Plane.
  • out dvec3 ret - Return array.

Return value

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

int segmentPlaneIntersection(dvec3 p0, dvec3 p1, dvec3 plane_point, dvec3 plane_normal, out 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 array.

Arguments

  • dvec3 p0 - Start point of the line segment.
  • dvec3 p1 - End point of the line segment.
  • dvec3 plane_point - Point on the plane.
  • dvec3 plane_normal - Normal to the plane.
  • out dvec3 ret - Return array.

Return value

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

double triangleArea(dvec3 v0, dvec3 v1, dvec3 v2)

Returns the triangle area.

Arguments

  • dvec3 v0 - The first triangle vertex.
  • dvec3 v1 - The second triangle vertex.
  • dvec3 v2 - The third triangle vertex.

Return value

Triangle area.

float triangleArea(vec3 v0, vec3 v1, vec3 v2)

Returns the triangle area.

Arguments

  • vec3 v0 - The first triangle vertex.
  • vec3 v1 - The second triangle vertex.
  • vec3 v2 - The third triangle vertex.

Return value

Triangle area.

dvec3 triangleNormal(dvec3 v0, dvec3 v1, dvec3 v2)

Returns the triangle normal vector.

Arguments

  • dvec3 v0 - The first triangle vertex.
  • dvec3 v1 - The second triangle vertex.
  • dvec3 v2 - The third triangle vertex.

Return value

Triangle normal vector.

vec3 triangleNormal(vec3 v0, vec3 v1, vec3 v2)

Returns the triangle normal vector.

Arguments

  • vec3 v0 - The first triangle vertex.
  • vec3 v1 - The second triangle vertex.
  • vec3 v2 - The third triangle vertex.

Return value

Triangle normal vector.

vec4 trianglePlane(vec3 v0, vec3 v1, vec3 v2)

Returns the triangle plane.

Arguments

  • vec3 v0 - The first triangle vertex.
  • vec3 v1 - The second triangle vertex.
  • vec3 v2 - The third triangle vertex.

Return value

Triangle plane.

dvec4 trianglePlane(dvec3 v0, dvec3 v1, dvec3 v2)

Returns the triangle plane.

Arguments

  • dvec3 v0 - The first triangle vertex.
  • dvec3 v1 - The second triangle vertex.
  • dvec3 v2 - The third triangle vertex.

Return value

Triangle plane.

vec4 triangleTangent(vec3 v0, vec3 v1, vec3 v2, vec2 t0, vec2 t1, vec2 t2)

Returns the triangle tangent space.

Arguments

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

Return value

Triangle tangent space vector.

vec4 triangleTangent(vec3 v0, vec3 v1, vec3 v2, vec2 t0, vec2 t1, vec2 t2, vec3 normal)

Returns the triangle tangent space.

Arguments

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

Return value

Triangle tangent space vector.

vec4 triangleTangent(vec3 v0, vec3 v1, vec3 v2)

Returns the triangle tangent space.

Arguments

  • vec3 v0 - The first triangle vertex.
  • vec3 v1 - The second triangle vertex.
  • vec3 v2 - The third triangle vertex.

Return value

Triangle tangent space vector.
Last update: 2018-08-10
Build: ()