コード例 #1
0
        public override Complex Evaluate(double t)
        {
            // TBD scale t for lines so +/-pi -> infinity
            double aa = 2 * b.Re;
            double bb = 2 * b.Im;

            if (Accuracy.LengthIsZero(aa))
            {
                return(new Complex(t, c / bb));
            }

            if (Accuracy.LengthIsZero(bb))
            {
                return(new Complex(c / aa, t));
            }

            //	double x = c / (aa * bb * bb * (1 / (aa * aa) + 1 / (bb * bb)));
            //	return  new ComplexPolar(t, LineAngle) + new Complex(x, (c - aa * x) / bb);

            Complex p0 = new Complex(c / aa, 0);
            Complex p1 = new Complex(0, c / bb);

            if (p1 == Complex.Zero)
            {
                p1 = Complex.CreatePolar(1, Angle);
            }

            return(p0 + (p1 - p0).Normalized * t);
            //return (p0 + p1) / 2 + (p1 - p0).Normalized * t;
        }
コード例 #2
0
        public static Complex operator /(Complex a, Complex b)
        {
            double automorphy = b.Re * b.Re + b.Im * b.Im;

            Debug.Assert(!Accuracy.LengthIsZero(Math.Sqrt(automorphy)));
            return(new Complex((a.Re * b.Re + a.Im * b.Im) / automorphy, (a.Im * b.Re - a.Re * b.Im) / automorphy));
        }
コード例 #3
0
        public static CircLine Create(double a, Complex b, double c)
        {
            if (Accuracy.LengthIsZero(a))
            {
                return(new Line(b, c));
            }

            return(new Circle(a, b, c));
        }
コード例 #4
0
        public void DrawGL(Color4 color)
        {
            if (Accuracy.LengthIsZero(bounds.Span))
            {
                return;
            }

            GL.Begin(BeginMode.LineStrip);
            GL.Color4(color);

            IList <Complex> points = Polygon;

            for (int i = 0; i < points.Count; i++)
            {
                GL.Vertex3(points[i].Vector3d);
            }

            GL.End();
        }
コード例 #5
0
 public bool ContainsPoint(Complex p)
 {
     return(Accuracy.LengthIsZero(a * p.ModulusSquared + (b.Conjugate * p + b * p.Conjugate).Re + c));
 }