0

Revolved Method

Anonymous 10 years ago 0
This discussion was imported from CodePlex

CesarMayorine wrote at 2013-12-27 22:03:

I need a example (C# or VB) to revolve a Line and this into the View.

Thanks

AnotherBor wrote at 2014-01-07 05:29:

You probably should look at
MeshBuilder.AddRevolvedGeometry
method.

CesarMayorine wrote at 2014-01-08 12:25:

thanks for your answer,

have you a practical example (code) in c # or vb, that I can use?

AnotherBor wrote at 2014-01-09 06:37:



Done with this code:
(there is a mistake in AddRevolvedGeometry description saying that profile point's X is radius and Y is position along the axis. Actually it is the other way around. X is position along the axis, Y is the radius.)
_meshBuilder = new MeshBuilder(true, true);

List<Point> profile = new List<Point>(new[]{new Point(0, 20), new Point(3, 18), new Point(5, 5), new Point(17, 5), new Point(20, 7), new Point(25, 25), new Point(35, 28), new Point(50, 23)});

_meshBuilder.AddRevolvedGeometry(profile, new Point3D(0,0,0), new Vector3D(0, 0, 1), 100);
        
var mesh2 = _meshBuilder.ToMesh(true);              
_modelGroup.Children.Add(new GeometryModel3D{Geometry = mesh2, Material = _sampleMaterial, BackMaterial = _sampleMaterial});
You can find basic scene setup in every example in the toolkit sources.

objo wrote at 2014-01-10 09:05:

Thanks for the notice, I have corrected the description of the method.
AnotherBor: can we include your code in the examples?

AnotherBor wrote at 2014-01-10 09:08:

You're welcome!
Go ahead, but I think the code is so generic that you really didn't have to ask :)

objo wrote at 2014-01-10 09:37:

I wasn't sure if you had copyright on the design of the glass ;)

AnotherBor wrote at 2014-01-10 09:54:

Let me scribe my name on it... ;)

objo wrote at 2014-02-02 12:49:

Added example to ExampleBrowser/MeshVisuals