We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem in CreatePolygon

I want to create a polygon with two line ,the two line looks like the image below:polygon 错误.png (4.5 KB)

,I use different point distance online, when point number more than 20, I found most time ,the polygon Can’t be create right。 is there a bug in aspose.3d?

@wenwu20082001

Thank you for contacting support.

Would you please elaborate the problem a little more, along with a code snippet reproducing this behavior so that we may try to reproduce and investigate it in our environment.

there is the code
string coorlist = “14.607285,16.557086 13.001963,12.353166 11.396641,8.149246 9.791319,3.945327 8.759057,1.242101 4.259501,1.305308 -0.240055,1.368516 -4.739611,1.431724 -9.239167,1.494931 -9.600000,1.500000 -10.350000,1.299038 -10.899038,0.750000 -12.573967,-3.426675 -14.248896,-7.603350 -15.923824,-11.780025 -17.392715,-15.442914 -14.607285,-16.557086 -13.001963,-12.353166 -11.396641,-8.149246 -9.791319,-3.945327 -8.759057,-1.242101 -4.259501,-1.305308 0.240055,-1.368516 4.739611,-1.431724 9.239167,-1.494931 9.600000,-1.500000 10.350000,-1.299038 10.899038,-0.750000 12.573967,3.426675 14.248896,7.603350 15.923824,11.780025 17.392715,15.442914”;

            string[] items = coorlist.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
          Vector4[]  controlPoints = new Vector4[items.Length*2];
            //the higher level with z value 5
            for (int i = 0; i < items.Length; i++)
            {
                string[] values = items[i].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                controlPoints[i] = new Vector4(double.Parse(values[0]), double.Parse(values[1]),5);
             }

           // z value is 0
            for (int i = 0; i < items.Length; i++)
            {
                controlPoints[i+items.Length] = new Vector4(controlPoints[i].x, controlPoints[i].y, 0);
            }

            //all point,int two z value, add two polygon to mesh 
            mesh_Top.ControlPoints.AddRange(controlPoints);

            PolygonBuilder builder = new PolygonBuilder(mesh_Top);
            builder.Begin();
            for (int i = 0; i < controlPoints.Length/2; i++)
            {
                builder.AddVertex(i);
            }
            builder.End();

            builder = new PolygonBuilder(mesh_Top);
            builder.Begin();
            for (int i = controlPoints.Length/2; i < controlPoints.Length; i++)
            {
                builder.AddVertex(i);
            }
            builder.End();
            scene.RootNode.CreateChildNode("top", mesh_Top);
           scene.RootNode.Transform.TransformMatrix = new Matrix4(
            1, 0, 0, 0,
            0, 0, -1, 0,
            0, 1, 0, 0,
            0, 0, 0, 1
            );

the result should be disply right.jpg (17.2 KB)
but the result is display wrong.png (12.7 KB)

@wenwu20082001

Thank you for sharing requested data.

Please mention how is the scene in display right.jpg is generated and there are few undeclared variables involved in the code snippet. For example, mesh_Top and scene. Please share a self-contained code snippet so that we may try to reproduce and investigate it to help you out.