15,905,136 members
1.00/5 (1 vote)
See more:
xaml code :-
XML
``` <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>```

C# code :-

C#
```// 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 + 1) % 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;

What I have tried:

`I really want such a result this is my image:-"https://ibb.co/fkzGV3Q" but my C# code dont show any result me`
Posted
Updated 27-Jan-23 23:51pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 Pete O'Hanlon 25 Dave Kreskowiak 20 sahabiswarup 5 El_Codero 5 Richard Deeming 5
 Pete O'Hanlon 1,740 OriginalGriff 1,307 Richard Deeming 550 Dave Kreskowiak 435 Richard MacCutchan 355

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900