gradientspace / geometry3Sharp

C# library for 2D/3D geometric computation, mesh algorithms, and so on. Boost license.
http://www.gradientspace.com
Boost Software License 1.0
1.71k stars 389 forks source link

MeshBoundaryLoops Extrude problem #135

Closed vibra2020 closed 4 years ago

vibra2020 commented 4 years ago

Hi,
i am trying to extrude boundary loop of a mesh. when the object's rotation is zero, extrude came good, but whenever i rotated the object, extrude direction will be different. The black line is the center normal of that edge loop.

    MeshBoundaryLoops loops2 = new MeshBoundaryLoops(mesh);
   EdgeLoop eLoop = new EdgeLoop(mesh);
    eLoop.Edges = loops2[1].Edges;
    eLoop.Vertices = loops2[1].Vertices;

    float extrudeLen = 1f;
    new MeshExtrudeLoop(mesh, eLoop)
    {
        PositionF = ((Func<Vector3d, Vector3f, int, Vector3d>)((v, n, vid) => v + extrudeLen * planeNormal))
    }.Extrude();

    testObj.GetComponent<MeshFilter>().mesh = g3UnityUtils.DMeshToUnityMesh(mesh);

image

vibra2020 commented 4 years ago

No Response?. Please give me a response.