Class Projection
Functions for projecting 3d points to 2d space.
Namespace: UnityEngine.ProBuilder
Syntax
public static class Projection
Methods
FindBestPlane(IList<Vector3>, IList<Int32>)
Find a plane that best fits a set of 3d points.
Declaration
public static Plane FindBestPlane(IList<Vector3> points, IList<int> indexes = null)
Parameters
Type | Name | Description |
---|---|---|
IList<Vector3> | points | The points to find a plane for. Order does not matter. |
IList<Int32> | indexes | If provided, only the vertices referenced by the indexes array will be considered. |
Returns
Type | Description |
---|---|
Plane | A plane that best matches the layout of the points array. |
Remarks
PlanarProject(IList<Vector3>, IList<Int32>)
Project a collection of 3d positions to a 2d plane. The direction from which the vertices are projected is calculated using FindBestPlane(IList<Vector3>, IList<Int32>).
Declaration
public static Vector2[] PlanarProject(IList<Vector3> positions, IList<int> indexes = null)
Parameters
Type | Name | Description |
---|---|---|
IList<Vector3> | positions | A collection of positions to project based on a direction. |
IList<Int32> | indexes |
Returns
Type | Description |
---|---|
Vector2[] | The positions array projected into 2d coordinates. |
PlanarProject(IList<Vector3>, IList<Int32>, Vector3)
Project a collection of 3d positions to a 2d plane.
Declaration
public static Vector2[] PlanarProject(IList<Vector3> positions, IList<int> indexes, Vector3 direction)
Parameters
Type | Name | Description |
---|---|---|
IList<Vector3> | positions | A collection of positions to project based on a direction. |
IList<Int32> | indexes | A collection of indices to project. The returned array will match the length of indices. |
Vector3 | direction | The direction from which vertex positions are projected into 2d space. |
Returns
Type | Description |
---|---|
Vector2[] | The positions array projected into 2d coordinates. |