Class SplineMesh
Manages the communication between a spline object and the corresponding mesh. Provides methods to manipulate the spline and mesh simultaneously.
Inheritance
Namespace: VRSketchingGeometry.Meshing
Assembly: VRSketchingGeometry.dll
Syntax
public class SplineMesh
Remarks
Original author: tterpi
Constructors
SplineMesh(Spline)
Contructor with default circular cross section and default tube mesh implementation.
Declaration
public SplineMesh(Spline spline)
Parameters
| Type | Name | Description |
|---|---|---|
| Spline | spline |
Remarks
Scale is 0.4 and cross section resolution is 6.
SplineMesh(Spline, Vector3, Int32)
Contructor for a spline mesh using the default TubeMesh implementation.
Declaration
public SplineMesh(Spline spline, Vector3 crossSectionScale, int crossSectionResolution = 6)
Parameters
| Type | Name | Description |
|---|---|---|
| Spline | spline | |
| UnityEngine.Vector3 | crossSectionScale | |
| System.Int32 | crossSectionResolution | Number of vertices per circular cross section. There will be one more vertex per cross section to create a seam for UV mapping reasons. |
SplineMesh(Spline, ITubeMesh)
Contructor for setting a specific ITubeMesh implementation.
Declaration
public SplineMesh(Spline spline, ITubeMesh tubeMesh)
Parameters
| Type | Name | Description |
|---|---|---|
| Spline | spline | The spline implementation to be used. |
| ITubeMesh | tubeMesh | The ITubeMesh implementation to use. |
Methods
AddControlPoint(Vector3)
Add a control point to the end of the spline.
Declaration
public Mesh AddControlPoint(Vector3 controlPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Vector3 | controlPoint |
Returns
| Type | Description |
|---|---|
| UnityEngine.Mesh |
DeleteControlPoint(Int32)
Delete the control point at index.
Declaration
public Mesh DeleteControlPoint(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
Returns
| Type | Description |
|---|---|
| UnityEngine.Mesh |
GetControlPoints()
Declaration
public List<Vector3> GetControlPoints()
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.List<UnityEngine.Vector3> |
GetCrossSection()
Get a copy of the cross section used by the tube mesh.
Declaration
public CrossSection GetCrossSection()
Returns
| Type | Description |
|---|---|
| CrossSection |
GetCrossSectionShape(out List<Vector3>, out List<Vector3>)
Get the cross section.
Declaration
public void GetCrossSectionShape(out List<Vector3> crossSectionShape, out List<Vector3> crossSectionShapeNormals)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<UnityEngine.Vector3> | crossSectionShape | A copy of the cross section shape is assigned to this variable. |
| System.Collections.Generic.List<UnityEngine.Vector3> | crossSectionShapeNormals | A copy of the cross section normals is assigned to this variable. |
GetNumberOfControlPoints()
Declaration
public int GetNumberOfControlPoints()
Returns
| Type | Description |
|---|---|
| System.Int32 |
InsertControlPoint(Int32, Vector3)
Insert control point at index.
Declaration
public Mesh InsertControlPoint(int index, Vector3 controlPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | |
| UnityEngine.Vector3 | controlPoint |
Returns
| Type | Description |
|---|---|
| UnityEngine.Mesh |
RefineMesh()
Refine the current mesh using the Parallel Transport algorithm.
Declaration
public Mesh RefineMesh()
Returns
| Type | Description |
|---|---|
| UnityEngine.Mesh |
SetControlPoint(Int32, Vector3)
Replace the control point at index.
Declaration
public Mesh SetControlPoint(int index, Vector3 controlPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | |
| UnityEngine.Vector3 | controlPoint |
Returns
| Type | Description |
|---|---|
| UnityEngine.Mesh |
SetControlPoints(Vector3[])
Set all control points.
Declaration
public Mesh SetControlPoints(Vector3[] controlPoints)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Vector3[] | controlPoints |
Returns
| Type | Description |
|---|---|
| UnityEngine.Mesh |
SetCrossSection(List<Vector3>, List<Vector3>, Vector3)
Change the cross section of the mesh. This will regenerete the mesh.
Declaration
public Mesh SetCrossSection(List<Vector3> crossSectionShape, List<Vector3> crossSectionNormals, Vector3 crossSectionDiameter)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<UnityEngine.Vector3> | crossSectionShape | |
| System.Collections.Generic.List<UnityEngine.Vector3> | crossSectionNormals | |
| UnityEngine.Vector3 | crossSectionDiameter | The requested diameter of the cross section. |
Returns
| Type | Description |
|---|---|
| UnityEngine.Mesh |
SetCrossSectionScale(Vector3)
The diameter of the spline will depend on the native size of the set cross section. The default circular cross section has a default diameter of 1.
Declaration
public Mesh SetCrossSectionScale(Vector3 scale)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Vector3 | scale |
Returns
| Type | Description |
|---|---|
| UnityEngine.Mesh |