public AddCornucopia ( Vector3D outerPoints, double>.System |
||
outerPoints | Vector3D | |
outerSizeFunc | double>.System | |
innerPoints | Vector3D | |
innerSizeFunc | double>.System | |
Résultat | void |
/// <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)); }
/// <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 ) ); }