Skip to content

Commit 05c2776

Browse files
committed
util fns
1 parent 39d3e8e commit 05c2776

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

mesh/MeshEditor.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections;
33
using System.Collections.Generic;
44
using System.Diagnostics;
5+
using System.Linq;
56

67

78
namespace g3
@@ -834,6 +835,12 @@ public void AppendLine(Segment3d seg, float size)
834835
f.AlignAxis(2, (Vector3f)seg.Direction);
835836
AppendBox(f, new Vector3f(size, size, seg.Extent));
836837
}
838+
public void AppendLine(Segment3d seg, float size, Colorf color)
839+
{
840+
Frame3f f = new Frame3f(seg.Center);
841+
f.AlignAxis(2, (Vector3f)seg.Direction);
842+
AppendBox(f, new Vector3f(size, size, seg.Extent), color);
843+
}
837844
public static void AppendBox(DMesh3 mesh, Vector3d pos, float size)
838845
{
839846
MeshEditor editor = new MeshEditor(mesh);
@@ -871,6 +878,22 @@ public static void AppendLine(DMesh3 mesh, Segment3d seg, float size)
871878

872879

873880

881+
public void AppendPathSolid(IEnumerable<Vector3d> vertices, double radius, Colorf color)
882+
{
883+
TubeGenerator tubegen = new TubeGenerator() {
884+
Vertices = new List<Vector3d>(vertices),
885+
Polygon = Polygon2d.MakeCircle(radius, 6),
886+
NoSharedVertices = false
887+
};
888+
DMesh3 mesh = tubegen.Generate().MakeDMesh();
889+
if (Mesh.HasVertexColors)
890+
mesh.EnableVertexColors(color);
891+
AppendMesh(mesh, Mesh.AllocateTriangleGroup());
892+
}
893+
894+
895+
896+
874897
/// <summary>
875898
/// Remove all bowtie vertices in mesh. Makes one pass unless
876899
/// bRepeatUntilClean = true, in which case repeats until no more bowties found

0 commit comments

Comments
 (0)