public RotateExtrude(double[] points, double axisOffset = 0, Alignment alignment = Alignment.z, string name = "") { if ((points.Length % 2) != 0) { throw new Exception("You must pass in an even number of points so they can be converted to Vector2s."); } List <Vector2> vectorPoints = new List <Vector2>(); for (int i = 0; i < points.Length; i += 2) { vectorPoints.Add(new Vector2(points[i], points[i + 1])); } root = new RotateExtrudePrimitive(vectorPoints.ToArray(), axisOffset, name); switch (alignment) { case Alignment.x: root = new Rotate(root, y: MathHelper.DegreesToRadians(90)); break; case Alignment.y: root = new Rotate(root, x: MathHelper.DegreesToRadians(90)); break; case Alignment.z: // don't need to do anything break; default: throw new NotImplementedException(); } }
public RotateExtrude(double[] points, double axisOffset = 0, Alignment alignment = Alignment.z, string name = "") { if ((points.Length % 2) != 0) { throw new Exception("You must pass in an even number of points so they can be converted to Vector2s."); } List<Vector2> vectorPoints = new List<Vector2>(); for (int i = 0; i < points.Length; i += 2) { vectorPoints.Add(new Vector2(points[i], points[i + 1])); } root = new RotateExtrudePrimitive(vectorPoints.ToArray(), axisOffset, name); switch (alignment) { case Alignment.x: root = new Rotate(root, y: MathHelper.DegreesToRadians(90)); break; case Alignment.y: root = new Rotate(root, x: MathHelper.DegreesToRadians(90)); break; case Alignment.z: // don't need to do anything break; default: throw new NotImplementedException(); } }
public RotateExtrude(Vector2[] points, double axisOffset, Alignment alignment = Alignment.z, string name = "") : base(name) { root = new RotateExtrudePrimitive(points, axisOffset, name); switch (alignment) { case Alignment.x: root = new Rotate(root, y: MathHelper.DegreesToRadians(90)); break; case Alignment.negX: root = new Rotate(root, y: MathHelper.DegreesToRadians(-90)); break; case Alignment.y: root = new Rotate(root, x: MathHelper.DegreesToRadians(90)); break; case Alignment.z: break; case Alignment.negZ: root = new Rotate(root, x: MathHelper.DegreesToRadians(180)); break; default: throw new NotImplementedException(); } }