/////////////////////////////////////////////// ////////////////////FIELDS///////////////////// /////////////////////////////////////////////// /*********************************************/ /////////////////////////////////////////////// /////////////////CONSTRUCTORS////////////////// /////////////////////////////////////////////// /// <param name="R1">size of X half-axis</param> /// <param name="R2">size of Y half-axis</param> /// <param name="VectorR1">Vector of x-axis positive direction</param> /// <param name="OvalCenter">Point of the center of the oval</param> public GlOval(float R1, float R2, GlVectorR2 VectorR1, GlPointR2 OvalCenter) { this.curvePoints = new GlPointR2[360]; if (VectorR1 == null || OvalCenter == null) { directVector = new GlVectorR2(0, 0); systemCenter = new GlPointR2(float.NaN, float.NaN); Ra = 0; Rb = 0; return; } this.systemCenter = new GlPointR2(OvalCenter); this.Ra = R1; this.Rb = R2; this.directVector = VectorR1; if (VectorR1.isNullVector()) { return; } this.Length = (int)Math.Ceiling(Math.PI * Math.Sqrt(2 * (R1 * R1 + R2 * R2))); updatePointsPosition(); }
/////////////////////////////////////////////// ////////////////////FIELDS///////////////////// /////////////////////////////////////////////// /*********************************************/ /////////////////////////////////////////////// /////////////////CONSTRUCTORS////////////////// /////////////////////////////////////////////// public GlParabola(float aCoeff, GlPointR2 Vertex, GlVectorR2 directVector) { this.curvePoints = new GlPointR2[360]; if (Vertex == null || directVector == null) { this.directVector = new GlVectorR2(0, 0); systemCenter = new GlPointR2(float.NaN, float.NaN); a = 0; return; } this.a = Math.Abs(aCoeff); this.systemCenter = Vertex; this.directVector = (aCoeff < 0 && !directVector.isNullVector()) ? directVector.getReversedVector() : directVector; if (isNullParabola()) { return; } updatePointsPosition(); }