Ejemplo n.º 1
0
 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));
 }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
        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);
        }