/// <summary> /// The constructor takes an array of doubles as the input to the polygon to extrude. /// </summary> /// <param name="points">Pairs of double values that will be used as the coordinates of the polygon points.</param> /// <param name="height"></param> /// <param name="alignment"></param> /// <param name="twistRadians"></param> /// <param name="name"></param> public LinearExtrude(double[] points, double height, Alignment alignment = Alignment.z, double twistRadians = 0, 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 LinearExtrudePrimitive(vectorPoints.ToArray(), height, twistRadians, 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; } }
/// <summary> /// The constructor takes an array of Vector2s as the input to the polygon to extrude. /// </summary> /// <param name="points"></param> /// <param name="height"></param> /// <param name="alignment"></param> /// <param name="twistRadians"></param> /// <param name="name"></param> public LinearExtrude(Vector2[] points, double height, Alignment alignment = Alignment.z, double twistRadians = 0, string name = "") : base(name) { root = new LinearExtrudePrimitive(points, height, twistRadians, 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; } }
/// <summary> /// The constructor takes an array of doubles as the input to the polygon to extrude. /// </summary> /// <param name="points">Pairs of double values that will be used as the coordinates of the polygon points.</param> /// <param name="height"></param> /// <param name="alignment"></param> /// <param name="twistRadians"></param> /// <param name="name"></param> public LinearExtrude(double[] points, double height, Alignment alignment = Alignment.z, double twistRadians = 0, 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 LinearExtrudePrimitive(vectorPoints.ToArray(), height, twistRadians, 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; } }