AddCornucopia() public method

Add a cornucopia. NOTE: outerPoints and innerPoints are ordered in a different direction.
public AddCornucopia ( Vector3D outerPoints, double>.System outerSizeFunc, Vector3D innerPoints, double>.System innerSizeFunc ) : void
outerPoints Vector3D
outerSizeFunc double>.System
innerPoints Vector3D
innerSizeFunc double>.System
return void
Example #1
0
        /// <summary>
        /// Function I was using for lamp project, probably a bit out of date.
        /// </summary>
        public static void AddToMeshLamp(Shapeways mesh, Vector3D v1, Vector3D v2)
        {
            // need to get these from CalcBallArc
            Vector3D center   = Vector3D.DneVector();
            double   radius   = double.NaN;
            Vector3D normal   = Vector3D.DneVector();
            double   angleTot = double.NaN;

            double length1 = Scale(2.1);                // 12-end piece
            //double length1 = Scale( 1.6 );	// 6-end piece
            //double length1 = Scale( 1.4 );	// 4-end piece
            double length2 = Scale(0.5);

            double outerRadStart = Scale(0.0625 / 2);
            double outerRadEnd   = Scale(0.25 / 2);

            System.Func <Vector3D, double> outerSizeFunc = v =>
            {
                double angle = (v1 - center).AngleTo(v - center);
                double len   = radius * angle;
                return(outerRadStart + (outerRadEnd - outerRadStart) * (len / length1));
            };

            System.Func <Vector3D, double> outerSizeFunc2 = v =>
            {
                double angle = (v2 - center).AngleTo(v - center);
                double len   = radius * angle;
                return(outerRadStart + (outerRadEnd - outerRadStart) * (len / length1));
            };

            System.Func <Vector3D, double> innerSizeFunc = v =>
            {
                // Very slightly bigger than 1/8 inch OD.
                return(Scale(0.13 / 2));
            };

            Vector3D[] outerPoints = Shapeways.CalcArcPoints(center, radius, v1, normal, length1 / radius);
            Vector3D[] innerPoints = Shapeways.CalcArcPoints(center, radius, outerPoints[outerPoints.Length - 1], normal * -1, length2 / radius);
            mesh.AddCornucopia(outerPoints, outerSizeFunc, innerPoints, innerSizeFunc);

            outerPoints = Shapeways.CalcArcPoints(center, radius, v2, normal * -1, length1 / radius);
            innerPoints = Shapeways.CalcArcPoints(center, radius, outerPoints[outerPoints.Length - 1], normal, length2 / radius);
            mesh.AddCornucopia(outerPoints, outerSizeFunc2, innerPoints, innerSizeFunc);

            m_inventory.AddRod(Rod.Create(radius, angleTot));
        }
Example #2
0
        /// <summary>
        /// Function I was using for lamp project, probably a bit out of date.
        /// </summary>
        public static void AddToMeshLamp( Shapeways mesh, Vector3D v1, Vector3D v2 )
        {
            // need to get these from CalcBallArc
            Vector3D center = Vector3D.DneVector();
            double radius = double.NaN;
            Vector3D normal = Vector3D.DneVector();
            double angleTot = double.NaN;

            double length1 = Scale( 2.1 );	// 12-end piece
            //double length1 = Scale( 1.6 );	// 6-end piece
            //double length1 = Scale( 1.4 );	// 4-end piece
            double length2 = Scale( 0.5 );

            double outerRadStart = Scale( 0.0625 / 2 );
            double outerRadEnd = Scale( 0.25 / 2 );

            System.Func<Vector3D, double> outerSizeFunc = v =>
            {
                double angle = (v1 - center).AngleTo( v - center );
                double len = radius * angle;
                return outerRadStart + (outerRadEnd - outerRadStart) * (len / length1);
            };

            System.Func<Vector3D, double> outerSizeFunc2 = v =>
            {
                double angle = (v2 - center).AngleTo( v - center );
                double len = radius * angle;
                return outerRadStart + (outerRadEnd - outerRadStart) * (len / length1);
            };

            System.Func<Vector3D, double> innerSizeFunc = v =>
            {
                // Very slightly bigger than 1/8 inch OD.
                return Scale( 0.13 / 2 );
            };

            Vector3D[] outerPoints = Shapeways.CalcArcPoints( center, radius, v1, normal, length1 / radius );
            Vector3D[] innerPoints = Shapeways.CalcArcPoints( center, radius, outerPoints[outerPoints.Length - 1], normal * -1, length2 / radius );
            mesh.AddCornucopia( outerPoints, outerSizeFunc, innerPoints, innerSizeFunc );

            outerPoints = Shapeways.CalcArcPoints( center, radius, v2, normal * -1, length1 / radius );
            innerPoints = Shapeways.CalcArcPoints( center, radius, outerPoints[outerPoints.Length - 1], normal, length2 / radius );
            mesh.AddCornucopia( outerPoints, outerSizeFunc2, innerPoints, innerSizeFunc );

            m_inventory.AddRod( Rod.Create( radius, angleTot ) );
        }