AB4D Forum
Eccentric ConeTube - Printable Version

+- AB4D Forum (https://forum.ab4d.com)
+-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4)
+--- Forum: Ab3d.PowerToys (https://forum.ab4d.com/forumdisplay.php?fid=9)
+--- Thread: Eccentric ConeTube (/showthread.php?tid=4287)



Eccentric ConeTube - mattia.riviera - 09-29-2021

Is there a way to create an Eccentric ConeTube?


RE: Eccentric ConeTube - abenedik - 09-29-2021

This can be created by first creating a symmetrical cone tube and then manually adjusting the top or bottom positions.

For example:
Code:
var coneMesh = new Ab3d.Meshes.TubeMesh3D(bottomCenterPosition: new Point3D(0, 0, 0),
                                          heightDirection: new Vector3D(0, 1, 0),
                                          bottomOuterRadius: 100,
                                          bottomInnerRadius: 90,
                                          topOuterRadius: 50,
                                          topInnerRadius: 40,
                                          height: 100,
                                          segments: 30);

var coneMeshGeometry3D = coneMesh.Geometry;

var positions = coneMeshGeometry3D.Positions; // read Positions DependencyProperty only once
int count = positions.Count;

var offsetVector = new Vector3D(-50, 0, 0); // offest top positions by X = -50; this will make the left edge vertical

for (int i = 0; i < count; i++)
{
    if (positions[i].Y > 50) // adjust only top positions (they have Y set to 100, but to avoid using equals on floating point, we just use bigger then 50)
        positions[i] += offsetVector;
}


var geometryModel3D = new GeometryModel3D(coneMeshGeometry3D, new DiffuseMaterial(Brushes.Orange));

MainViewport.Children.Add(geometryModel3D.CreateModelVisual3D());

This produces the following model:
   


RE: Eccentric ConeTube - mattia.riviera - 09-29-2021

Hi Abenedik, thank you for the tip.

Best regards.

Mattia