Show / Hide Table of Contents

Class TubeMesh

Generates a tube like mesh according to a set of points on a line

Inheritance
System.Object
TubeMesh
Implements
ITubeMesh
Namespace: VRSketchingGeometry.Meshing
Assembly: VRSketchingGeometry.dll
Syntax
public class TubeMesh : ITubeMesh
Remarks

Original author: tterpi This class was originally called LineExtruder. It was renamed to make it consistant with the other mesh classes such as PatchMesh and RibbonMesh.

Constructors

TubeMesh(List<Vector3>, List<Vector3>, Vector3, Boolean)

Constructor for a TubeMesh object.

Declaration
public TubeMesh(List<Vector3> crossSectionShape, List<Vector3> crossSectionNormals, Vector3 crossSectionScale, bool generateCaps = true)
Parameters
Type Name Description
System.Collections.Generic.List<UnityEngine.Vector3> crossSectionShape

Vertices of the cross section.

System.Collections.Generic.List<UnityEngine.Vector3> crossSectionNormals

Normals of the cross section.

UnityEngine.Vector3 crossSectionScale

Scale of the cross section.

System.Boolean generateCaps

Should the holes at the end of the tube be closed.

Properties

CrossSectionScale

Declaration
public Vector3 CrossSectionScale { get; }
Property Value
Type Description
UnityEngine.Vector3

Methods

GenerateCapsMesh(List<Vector3>, List<Vector3>, Int32)

Generate the mesh for the end caps that close the holes at the end of the tube.

Declaration
public static (List<Vector3>, List<Vector3>, List<int>) GenerateCapsMesh(List<Vector3> firstCrossSectionVertices, List<Vector3> lastCrossSectionVertices, int firstTriangleIndex)
Parameters
Type Name Description
System.Collections.Generic.List<UnityEngine.Vector3> firstCrossSectionVertices
System.Collections.Generic.List<UnityEngine.Vector3> lastCrossSectionVertices
System.Int32 firstTriangleIndex
Returns
Type Description
System.ValueTuple<System.Collections.Generic.List<UnityEngine.Vector3>, System.Collections.Generic.List<UnityEngine.Vector3>, System.Collections.Generic.List<System.Int32>>

Vertices, normals, triangles.

GenerateMesh(List<Vector3>)

Regenerate the whole mesh with the given points.

Declaration
public Mesh GenerateMesh(List<Vector3> points)
Parameters
Type Name Description
System.Collections.Generic.List<UnityEngine.Vector3> points
Returns
Type Description
UnityEngine.Mesh

GetCrossSection()

Get a copy of the cross section currently in use.

Declaration
public CrossSection GetCrossSection()
Returns
Type Description
CrossSection

GetMeshWithCaps(List<Vector3>, List<Vector3>, List<Int32>, List<Vector3>, List<Vector3>, List<Int32>, Int32)

Put all parts of the mesh together in a Mesh object.

Declaration
public static Mesh GetMeshWithCaps(List<Vector3> vertices, List<Vector3> normals, List<int> triangles, List<Vector3> capVertices, List<Vector3> capNormals, List<int> capTriangles, int crossSectionVertexCount)
Parameters
Type Name Description
System.Collections.Generic.List<UnityEngine.Vector3> vertices
System.Collections.Generic.List<UnityEngine.Vector3> normals
System.Collections.Generic.List<System.Int32> triangles
System.Collections.Generic.List<UnityEngine.Vector3> capVertices
System.Collections.Generic.List<UnityEngine.Vector3> capNormals
System.Collections.Generic.List<System.Int32> capTriangles
System.Int32 crossSectionVertexCount
Returns
Type Description
UnityEngine.Mesh

ReplacePoints(List<Vector3>, Int32, Int32, Int32)

Replaces and/or removes points from an existing mesh. This should only be called when GenerateMesh(List<Vector3>) was called before at least once. Different from GenerateMesh(List<Vector3>) this will only recalculate the parts that were changed according to the parameters.

Declaration
public Mesh ReplacePoints(List<Vector3> points, int index, int addCount, int removeCount)
Parameters
Type Name Description
System.Collections.Generic.List<UnityEngine.Vector3> points

All points of the complete line.

System.Int32 index

First point to be added or removed.

System.Int32 addCount

Number of points to add at index.

System.Int32 removeCount

Number of points to remove at index before adding the new ones.

Returns
Type Description
UnityEngine.Mesh

SetCrossSection(List<Vector3>, CrossSection)

Change the cross section used for generating the tube mesh.

Declaration
public Mesh SetCrossSection(List<Vector3> points, CrossSection crossSection)
Parameters
Type Name Description
System.Collections.Generic.List<UnityEngine.Vector3> points
CrossSection crossSection
Returns
Type Description
UnityEngine.Mesh
Remarks

Points have to be provided because this class does not keep a copy of the interpolated points.

TransformNormals(List<Vector3>, Vector3)

Transform a list of normals.

Declaration
public static List<Vector3> TransformNormals(List<Vector3> normals, Vector3 tangent)
Parameters
Type Name Description
System.Collections.Generic.List<UnityEngine.Vector3> normals
UnityEngine.Vector3 tangent
Returns
Type Description
System.Collections.Generic.List<UnityEngine.Vector3>

TransformPoints(List<Vector3>, Vector3, Vector3, Vector3)

Transform the points of a cross section for example.

Declaration
public static List<Vector3> TransformPoints(List<Vector3> points, Vector3 position, Vector3 tangent, Vector3 scale)
Parameters
Type Name Description
System.Collections.Generic.List<UnityEngine.Vector3> points

List of points to transform.

UnityEngine.Vector3 position

Position of the origin of the points.

UnityEngine.Vector3 tangent

Tangent to the spline at position.

UnityEngine.Vector3 scale
Returns
Type Description
System.Collections.Generic.List<UnityEngine.Vector3>

Implements

ITubeMesh
In This Article
Back to top Generated by DocFX