protected void InitializeMatrices() { scaleMatrix = Matrix.Scaling(new Vector3(scale, 0f)); positionMatrix = Matrix.Translation(new Vector3(position, 0)); originMatrix = Matrix.Translation(new Vector3(-origin, 0)); rotationMatrix = Matrix.RotationZ(MathUtil.DegreesToRadians(degrees)); }
private PolygonPoint GetPoint(float degrees, float radius) { float radAngle = MathUtil.DegreesToRadians(degrees) - MathUtil.PiOverTwo; double x = Math.Cos(radAngle) * radius; double y = Math.Sin(radAngle) * radius; return(new PolygonPoint(x, y)); }
public PTriangle(Vector2 a, float lengthAB, float angleB, uint thickness) : base(thickness) { if (angleB >= 180) { throw new ArgumentException("Angle cannot be greater than or equal to 180."); } this.position = a; this.a = a; this.b = new Vector2(a.X + lengthAB, a.Y); this.c = b + RadianToVector(MathUtil.DegreesToRadians(angleB) - MathUtil.PiOverTwo) * lengthAB; }
internal override List <PolygonPoint> GetPoints(float thickness = 0) { List <PolygonPoint> points = new List <PolygonPoint>(); float degreeStep = 360f / sides; float r = radius - thickness; for (int i = 0; i < sides; i++) { float radAngle = MathUtil.DegreesToRadians(degreeStep * i); double x = Math.Cos(radAngle) * r; double y = Math.Sin(radAngle) * r; points.Add(new PolygonPoint(x, y)); } if (!Filled) { points.Add(points[0]); } return(points); }