R3.Geometry.Circle3D.Subdivide C# (CSharp) Method

Subdivide() public method

Calculate n points around the circle
public Subdivide ( int n ) : Vector3D[]
n int
return Vector3D[]
        public Vector3D[] Subdivide( int n )
        {
            List<Vector3D> points = new List<Vector3D>();
            Vector3D start = Normal.Perpendicular();
            start *= Radius;

            double angleInc = 2 * Math.PI / n;
            for( int i=0; i<n; i++ )
            {
                Vector3D v = start;
                v.RotateAboutAxis( Normal, angleInc * i );
                points.Add( Center + v );
            }

            return points.ToArray();
        }

Usage Example

コード例 #1
0
ファイル: H3Ruled.cs プロジェクト: roice3/Honeycombs
        public H3.Cell.Edge[] Hyperboloid()
        {
            // Draw to circles of fibers, then twist them.
            List<H3.Cell.Edge> fiberList = new List<H3.Cell.Edge>();

            Vector3D cen = new Vector3D( 0, 0, 0.5 );
            double rad = .3;
            Circle3D c1 = new Circle3D { Center = cen, Radius = rad };
            Circle3D c2 = new Circle3D { Center = -cen, Radius = rad };

            int n = 50;
            Vector3D[] points1 = c1.Subdivide( n );
            Vector3D[] points2 = c2.Subdivide( n );

            double twist = 2 * Math.PI / 3;
            for( int i = 0; i < points2.Length; i++ )
            {
                points2[i].RotateXY( twist );

                Vector3D e1, e2;
                H3Models.Ball.GeodesicIdealEndpoints( points1[i], points2[i], out e1, out e2 );

                e1 = Transform( e1 );
                e2 = Transform( e2 );

                fiberList.Add( new H3.Cell.Edge( e1, e2 ) );
            }

            return fiberList.ToArray();
        }