Show / Hide Table of Contents

Class InsidenessCalculator

This class contains functions for determining whether a point is within an open mesh.

It is intended for use with the corners of voxel cubes, as seen in Tileset.

Inheritance
System.Object
InsidenessCalculator
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: CarbideFunction.Wildtile
Syntax
public static class InsidenessCalculator

Methods

GetLineIntersectionZDistance(Quaternion, Vector3, Triangle)

This function calculates the distance of the line to the contact point on the triangle.

Declaration
public static float GetLineIntersectionZDistance(Quaternion rayInverseOrientation, Vector3 rayOffset, Triangle tri)
Parameters
Type Name Description
Quaternion rayInverseOrientation

The quaternion that rotates the mesh into ray space, so that the ray points along the positive Z axis.

Vector3 rayOffset

The vector that the ray starts at after rotating to ray space.

Triangle tri

The triangle to test against.

Returns
Type Description
System.Single

IsWithinHalfSpace(Vector2, Vector2, Vector2)

This function calculates if a 2D point is within the half space defined by two vertices.

Declaration
public static bool IsWithinHalfSpace(Vector2 queryPoint, Vector2 vertex0, Vector2 vertex1)
Parameters
Type Name Description
Vector2 queryPoint
Vector2 vertex0
Vector2 vertex1
Returns
Type Description
System.Boolean
Argument stateReturn value
The two vertices are the sameReturns true
The two vertices are different and not colinear with queryPointReturns true if queryPoint is clockwise of vertex1 from vertex0. Otherwise, returns false.
The two vertices are different and colinear with queryPointReturns true or false arbitrarily, but deterministically. Swapping vertex0 and vertex1 is guaranteed to give the opposite result.

IsWithinTriangle(Vector2, Vector2, Vector2, Vector2)

This function calculates if a 2D point is within a 2D triangle.

Declaration
public static InsidenessCalculator.LineIntersectionResult IsWithinTriangle(Vector2 queryPoint, Vector2 vertex0, Vector2 vertex1, Vector2 vertex2)
Parameters
Type Name Description
Vector2 queryPoint
Vector2 vertex0
Vector2 vertex1
Vector2 vertex2
Returns
Type Description
InsidenessCalculator.LineIntersectionResult

If two triangles share vertices but do not overlap, this function is guaranteed to return non-Missed for at most one of the triangles - there are no cases where a ray will hit two smooth triangles.

LineIntersectionWithTri(Quaternion, Vector2, Triangle)

This function calculates whether a 2D point projected along the Z axis hits a triangle, and, if so, which side of the triangle it hits.

Declaration
public static InsidenessCalculator.LineIntersectionResult LineIntersectionWithTri(Quaternion rayInverseOrientation, Vector2 ray2dOffset, Triangle tri)
Parameters
Type Name Description
Quaternion rayInverseOrientation

The quaternion that rotates the mesh into ray space, so that the ray points along the positive Z axis.

Vector2 ray2dOffset

The 2D vector to project the ray along the Z axis after rotating to ray space.

Triangle tri

The triangle to test against.

Returns
Type Description
InsidenessCalculator.LineIntersectionResult

LineSegmentIntersectionWithTri(Quaternion, Vector3, Triangle)

This function detects if a ray intersects with a triangle, and, if so, which side of the triangle it hits.

This function uses pre-processed parameters so that the caller can precalculate the ray parameters before passing them to many functions. This obfuscates the code but also speeds it up.

Declaration
public static InsidenessCalculator.LineIntersectionResult LineSegmentIntersectionWithTri(Quaternion rayInverseOrientation, Vector3 rayOffset, Triangle tri)
Parameters
Type Name Description
Quaternion rayInverseOrientation

The quaternion that rotates the mesh into ray space, so that the ray points along the positive Z axis.

Vector3 rayOffset

The vector that the ray starts at after rotating to ray space.

Triangle tri

The triangle to test against.

Returns
Type Description
InsidenessCalculator.LineIntersectionResult
In This Article
Generated by DocFX Version: 3.2.1 - click to show/hide other versions