<helix:HelixViewport3D x:Name="viewPort3d" Visibility="Visible" Margin="0,5,10.4,0" ZoomExtentsWhenLoaded="true" InfoBackground="{x:Null}" RenderTransformOrigin="0.5,0.507" ShowCoordinateSystem="True"> <!--Remember to add light to the scene--> <helix:DefaultLights/> <helix:GridLinesVisual3D Width="20" Length="20" MinorDistance="1" Thickness="0.05"/> <helix:MeshGeometryVisual3D> </helix:MeshGeometryVisual3D> </helix:HelixViewport3D>
// Create a new MeshGeometry3D var mesh = new MeshGeometry3D(); // Define the points for the circle int segments = 20; double radius = 1; Point3D center = new Point3D(0, 0, 0); for (int i = 0; i <= segments; i++) { double angle = (i / (double)segments) * 360; double x = radius * Math.Sin(angle); double y = radius * Math.Cos(angle); mesh.Positions.Add(new Point3D(x, y, 0) + new Vector3D(center.X, center.Y, center.Z)); mesh.Normals.Add(new Vector3D(0, 0, 1)); } // Define the triangles for the circle for (int i = 0; i < segments; i++) { mesh.TriangleIndices.Add(i); mesh.TriangleIndices.Add((i + 1) % segments); mesh.TriangleIndices.Add(segments); } // Create a new Model3D and add the mesh to it var model = new GeometryModel3D { Geometry = mesh }; // Add the Model3D to the viewport var modelVisual = new ModelVisual3D(); modelVisual.Content = model; viewPort3d.Children.Add(modelVisual);
I really want such a result this is my image:-"https://ibb.co/fkzGV3Q" but my C# code dont show any result me
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)