public void TestUnitVector()
        {
            float  oneOverSqrt2 = 1 / (float)Math.Sqrt(2);
            SizeF  unitVector;
            PointF origin;

            origin     = new PointF(0, 0);
            unitVector = new SizeF(Vector.CreateUnitVector(origin, origin + new SizeF(-1, 1)));
            Assert.IsTrue(FloatComparer.AreEqual(new SizeF(-oneOverSqrt2, oneOverSqrt2), unitVector));
            Assert.IsTrue(FloatComparer.AreEqual(unitVector.Width * unitVector.Width + unitVector.Height * unitVector.Height, 1), "Magnitude must be 1.");

            origin     = new PointF(-1, 1);
            unitVector = new SizeF(Vector.CreateUnitVector(origin, origin + new SizeF(-2, 2)));
            Assert.IsTrue(FloatComparer.AreEqual(new SizeF(-oneOverSqrt2, oneOverSqrt2), unitVector));
            Assert.IsTrue(FloatComparer.AreEqual(unitVector.Width * unitVector.Width + unitVector.Height * unitVector.Height, 1), "Magnitude must be 1.");

            origin     = new PointF(3, -1);
            unitVector = new SizeF(Vector.CreateUnitVector(origin, origin + new SizeF(-2, 2)));
            Assert.IsTrue(FloatComparer.AreEqual(new SizeF(-oneOverSqrt2, oneOverSqrt2), unitVector));
            Assert.IsTrue(FloatComparer.AreEqual(unitVector.Width * unitVector.Width + unitVector.Height * unitVector.Height, 1), "Magnitude must be 1.");

            origin     = new PointF(3, 1);
            unitVector = new SizeF(Vector.CreateUnitVector(origin, origin + new SizeF(-2, 2)));
            Assert.IsTrue(FloatComparer.AreEqual(new SizeF(-oneOverSqrt2, oneOverSqrt2), unitVector));
            Assert.IsTrue(FloatComparer.AreEqual(unitVector.Width * unitVector.Width + unitVector.Height * unitVector.Height, 1), "Magnitude must be 1.");
        }
Exemple #2
0
        private static Matrix CalcRotateMatrixFromOrthogonalBasis(Vector3D xAxis, Vector3D yAxis, Vector3D zAxis)
        {
            const float zeroTolerance = 0.0000001f;

            Platform.CheckForNullReference(xAxis, "xAxis");
            Platform.CheckForNullReference(yAxis, "yAxis");
            Platform.CheckForNullReference(zAxis, "zAxis");
            Platform.CheckFalse(xAxis.IsNull || yAxis.IsNull || zAxis.IsNull, "Input must be an orthogonal set of basis vectors (i.e. non-trivial vectors).");
            Platform.CheckTrue(FloatComparer.AreEqual(xAxis.Dot(yAxis), 0, zeroTolerance) &&
                               FloatComparer.AreEqual(xAxis.Dot(zAxis), 0, zeroTolerance) &&
                               FloatComparer.AreEqual(yAxis.Dot(zAxis), 0, zeroTolerance), "Input must be an orthogonal set of basis vectors (i.e. mutually perpendicular).");

            xAxis = xAxis.Normalize();
            yAxis = yAxis.Normalize();
            zAxis = zAxis.Normalize();

            //TODO (CR Sept 2010): is this a rotation matrix, or the definition of a coordinate system?
            var basis = new Matrix(4, 4);

            basis.SetRow(0, xAxis.X, xAxis.Y, xAxis.Z, 0);
            basis.SetRow(1, yAxis.X, yAxis.Y, yAxis.Z, 0);
            basis.SetRow(2, zAxis.X, zAxis.Y, zAxis.Z, 0);
            basis.SetRow(3, 0, 0, 0, 1);
            return(basis);
        }
Exemple #3
0
        public void TestSanity()
        {
            // AreEqual
            {
                float x = 1.0f;
                float y = 2.0f;
                float z = x + y;

                Assert.IsTrue(FloatComparer.AreEqual(z, 3.0f));
            }

            // IsGreaterThan
            {
                float x = 1.001f;
                float y = 1.0f;

                Assert.IsTrue(FloatComparer.IsGreaterThan(x, y));
            }

            // IsLessThan
            {
                float x = 1.001f;
                float y = 1.0f;

                Assert.IsTrue(FloatComparer.IsLessThan(y, x));
            }
        }
Exemple #4
0
        private static IGraphic CreateInteractivePolyline(IList <PointF> vertices)
        {
            var closed = FloatComparer.AreEqual(vertices[0], vertices[vertices.Count - 1]);

            // use a standard rectangle primitive if the axes defines an axis-aligned rectangle
            if (closed && vertices.Count == 5 && IsAxisAligned(vertices[0], vertices[1]) && IsAxisAligned(vertices[1], vertices[2]) && IsAxisAligned(vertices[2], vertices[3]) && IsAxisAligned(vertices[3], vertices[4]))
            {
                var bounds    = RectangleUtilities.ConvertToPositiveRectangle(RectangleUtilities.ComputeBoundingRectangle(vertices[0], vertices[1], vertices[2], vertices[3]));
                var rectangle = new RectanglePrimitive {
                    TopLeft = bounds.Location, BottomRight = bounds.Location + bounds.Size
                };
                return(new BoundableResizeControlGraphic(new BoundableStretchControlGraphic(new MoveControlGraphic(rectangle))));
            }
            else if (!closed && vertices.Count == 3)
            {
                var protractor = new ProtractorGraphic {
                    Points = { vertices[0], vertices[1], vertices[2] }
                };
                return(new VerticesControlGraphic(new MoveControlGraphic(protractor)));
            }
            else if (!closed && vertices.Count == 2)
            {
                var line = new PolylineGraphic {
                    Points = { vertices[0], vertices[1] }
                };
                return(new VerticesControlGraphic(new MoveControlGraphic(line)));
            }

            var polyline = new PolylineGraphic(closed);

            polyline.Points.AddRange(vertices);
            return(closed ? new PolygonControlGraphic(true, new MoveControlGraphic(polyline)) : new VerticesControlGraphic(true, new MoveControlGraphic(polyline)));
        }
        public void TestDot()
        {
            Vector3D v1 = new Vector3D(2.2F, -6.1F, 7.4F);
            Vector3D v2 = new Vector3D(3.8F, 3.7F, 4.1F);

            Assert.IsTrue(FloatComparer.AreEqual(v1.Dot(v2), 16.13F));
        }
Exemple #6
0
        public virtual bool AreEqual(Bitmap referenceImage, Bitmap testImage, Rectangle bounds)
        {
            Bitmap diffImage;
            var    result = PerformComparison(referenceImage, testImage, bounds, false, out diffImage);

            return(FloatComparer.AreEqual((float)result, 0));
        }
Exemple #7
0
        public virtual bool AreEqual(Bitmap referenceImage, Bitmap testImage, float tolerance)
        {
            Bitmap diffImage;
            var    result = PerformComparison(referenceImage, testImage, false, out diffImage);

            return(FloatComparer.AreEqual((float)result, 0, tolerance));
        }
Exemple #8
0
        internal void Validate()
        {
            int count = 0;

            // Check for null LUTs
            foreach (IComposableLut lut in this)
            {
                ++count;
                if (lut == null)
                {
                    throw new InvalidOperationException(SR.ExceptionLUTNotAdded);
                }
            }

            if (count == 0)             //do this instead of accessing Count b/c it can be expensive.
            {
                throw new InvalidOperationException(SR.ExceptionLUTNotAdded);
            }

            // Verify that the input range of the nth LUT is equal to the output
            // range of the n-1th LUT.
            for (int i = 1; i < count; i++)
            {
                IComposableLut curLut  = this[i];
                IComposableLut prevLut = this[i - 1];

                if (!FloatComparer.AreEqual(prevLut.MinOutputValue, curLut.MinInputValue) ||
                    !FloatComparer.AreEqual(prevLut.MaxOutputValue, curLut.MaxInputValue))
                {
                    throw new InvalidOperationException(SR.ExceptionLUTInputOutputRange);
                }
            }
        }
Exemple #9
0
        public override bool Evaluate()
        {
            if (m_comparer == null)
            {
                if (_comparerType != null && _comparerType.IsValid)
                {
                    m_comparer = (FloatComparer)System.Activator.CreateInstance(_comparerType.Type);
                }
                else
                {
                    throw new System.NullReferenceException("Null comparer");
                }
            }

            GameObject a = _providerA.GetValue();
            GameObject b = _providerB.GetValue();

            if (a == null || b == null)
            {
                return(false);
            }

            float relative = Vector3.Distance(a.transform.position, b.transform.position);

            return(m_comparer.Compare(relative, _distance.GetValue()));
        }
Exemple #10
0
        public void AddTag(Type tagType, float startTime = 0f, float duration = -1f)
        {
            if (!Valid)
            {
                return;
            }

            if (duration < 0)
            {
                duration = DurationInSeconds - startTime;
            }

            int existing = tags.Count(t => t.Type == tagType &&
                                      FloatComparer.AreEqual(t.startTime, startTime, FloatComparer.kEpsilon) &&
                                      FloatComparer.AreEqual(t.duration, duration, FloatComparer.kEpsilon));

            if (existing > 0)
            {
                return;
            }

            Undo.RecordObject(m_Asset, $"Add {TagAttribute.GetDescription(tagType)} tag");

            TagAnnotation newTag = TagAnnotation.Create(tagType, startTime, duration);

            tags.Add(newTag);

            NotifyChanged();
        }
        public void ThirdPersonMove(Vector3 vec)
        {
            if (vec.magnitude > 1f)
            {
                vec.Normalize();
            }

            vec = transform.InverseTransformDirection(vec);
            animator.applyRootMotion = true;
            vec = Vector3.ProjectOnPlane(vec, Vector3.up);

            if (!FloatComparer.AreEqual(vec.x, 0f, Mathf.Epsilon))//    || !FloatComparer.AreEqual(vec.z, 0f, Mathf.Epsilon))
            {
                m_TurnAmount = vec.x; /*Mathf.Atan2(vec.x, vec.z)*/;
            }
            else
            {
                m_TurnAmount = 0f;
            }

            m_ForwardAmount = vec.z * 2;
            ApplyExtraTurnRotation();

            UpdateAnimator(vec);
        }
Exemple #12
0
    public void ThirdPersonMove(Vector3 move)
    {
        if (move.magnitude > 1f)
        {
            move.Normalize();
        }

        move = transform.InverseTransformDirection(move);
        m_Animator.applyRootMotion = true;
        move = Vector3.ProjectOnPlane(move, Vector3.up);
        if (!FloatComparer.AreEqual(move.x, 0f, Mathf.Epsilon) ||
            !FloatComparer.AreEqual(move.z, 0f, Mathf.Epsilon))
        {
            m_TurnAmount = Mathf.Atan2(move.x, move.z);
        }
        else
        {
            m_TurnAmount = 0f;
        }

        m_ForwardAmount = move.z;

        ApplyExtraTurnRotation();

        UpdateAnimator(move);
    }
Exemple #13
0
 public void TestInvalidTolerance()
 {
     AssertException <ArgumentOutOfRangeException>(() => FloatComparer.Compare(0f, 0f, -1));
     AssertException <ArgumentOutOfRangeException>(() => FloatComparer.Compare(0f, 0f, 4 * 1024 * 1024));
     AssertException <ArgumentOutOfRangeException>(() => FloatComparer.Compare(0.0, 0.0, -1L));
     AssertException <ArgumentOutOfRangeException>(() => FloatComparer.Compare(0.0, 0.0, 2L * 1024 * 1024 * 1024 * 1024 * 1024));
 }
            public string GetPixelSpacing()
            {
                var spatialTransformProvider = _image as ISpatialTransformProvider;
                var imageSopProvider         = _image as IImageSopProvider;

                if (spatialTransformProvider != null && imageSopProvider != null && imageSopProvider.Frame.ImagePlaneHelper.IsValid)
                {
                    var imageSize        = _image.ClientRectangle.Size;
                    var positionSource   = spatialTransformProvider.SpatialTransform.ConvertToSource(new PointF(0, 0));
                    var bottomLeftSource = spatialTransformProvider.SpatialTransform.ConvertToSource(new PointF(0, imageSize.Height));
                    var topRightSource   = spatialTransformProvider.SpatialTransform.ConvertToSource(new PointF(imageSize.Width, 0));

                    var positionPatient    = imageSopProvider.Frame.ImagePlaneHelper.ConvertToPatient(positionSource);
                    var imageHeightPatient = (imageSopProvider.Frame.ImagePlaneHelper.ConvertToPatient(bottomLeftSource) - positionPatient).Magnitude;
                    var imageWidthPatient  = (imageSopProvider.Frame.ImagePlaneHelper.ConvertToPatient(topRightSource) - positionPatient).Magnitude;

                    var columnSpacing = imageWidthPatient / imageSize.Width;
                    var rowSpacing    = imageHeightPatient / imageSize.Height;

                    // if the aspect ratio is supposed to be 1, ensure the pixel spacing actually says so, regardless of floating point calculation differences
                    if (FloatComparer.AreEqual(1, rowSpacing / columnSpacing))
                    {
                        rowSpacing = columnSpacing = (rowSpacing + columnSpacing) / 2;
                    }

                    return(new SizeF(columnSpacing, rowSpacing).ToDicomAttributeString());
                }
                return(string.Empty);
            }
Exemple #15
0
        private static IGraphic CreateInteractiveInterpolated(IList <PointF> dataPoints)
        {
            var closed = FloatComparer.AreEqual(dataPoints[0], dataPoints[dataPoints.Count - 1]);
            var curve  = CreateInterpolated(dataPoints);

            return(closed ? new PolygonControlGraphic(true, new MoveControlGraphic(curve)) : new VerticesControlGraphic(true, new MoveControlGraphic(curve)));
        }
Exemple #16
0
 protected override void Start()
 {
     base.Start();
     InitLayer();
     InitDirection();
     comparer = new FloatComparer(deviation);
 }
Exemple #17
0
        /// <summary>
        /// Initializes a <see cref="VolumeSlicerParams"/> for a slice orientation defined as a 4x4 affine transformation matrix.
        /// </summary>
        /// <param name="sliceRotation">The desired 4x4 affine transformation matrix.</param>
        /// <exception cref="ArgumentNullException">Thrown if the provided matrix is null.</exception>
        /// <exception cref="ArgumentException">Thrown if the provided matrix is not an affine transform.</exception>
        public VolumeSlicerParams(Matrix sliceRotation)
        {
            const string invalidTransformMessage = "sliceRotation must be a 4x4 affine transformation matrix.";

            Platform.CheckForNullReference(sliceRotation, "sliceRotation");
            Platform.CheckTrue(sliceRotation.Columns == 4 && sliceRotation.Rows == 4, invalidTransformMessage);
            Platform.CheckTrue(FloatComparer.AreEqual(sliceRotation[3, 0], 0), invalidTransformMessage);
            Platform.CheckTrue(FloatComparer.AreEqual(sliceRotation[3, 1], 0), invalidTransformMessage);
            Platform.CheckTrue(FloatComparer.AreEqual(sliceRotation[3, 2], 0), invalidTransformMessage);
            Platform.CheckTrue(FloatComparer.AreEqual(sliceRotation[3, 3], 1), invalidTransformMessage);

            //is this a "rotation matrix" or a "desired coordinate system"
            _slicingPlaneRotation = sliceRotation;

            //TODO (CR Sept 2010): if the input matrix is a rotation matrix, why are we not just extracting values
            //for _rotateAboutX, etc.  Also, _slicingPlaneRotation seems more or less unused.
            double yRadians = (float)Math.Asin(sliceRotation[0, 2]);
            double cosY     = Math.Cos(yRadians);

            _rotateAboutX = (float)Math.Atan2(-sliceRotation[1, 2] / cosY, sliceRotation[2, 2] / cosY) * _degreesPerRadian;
            _rotateAboutY = (float)yRadians * _degreesPerRadian;
            _rotateAboutZ = (float)Math.Atan2(-sliceRotation[0, 1] / cosY, sliceRotation[0, 0] / cosY) * _degreesPerRadian;

            _description = string.Format(SR.FormatSliceCustom, _rotateAboutX, _rotateAboutY, _rotateAboutZ);
        }
        public override sealed void UpdateSceneGraph(vtkRenderer vtkRenderer)
        {
            if (Disposed)
            {
                return;
            }

            vtkRenderer.SetBackground(VtkHelper.ConvertToVtkColor(_backgroundColor));

            uint mTime;

            using (var camera = vtkRenderer.GetActiveCamera())
                using (var vtkRenderWindow = vtkRenderer.GetRenderWindow())
                {
                    var clientSize = vtkRenderWindow.GetSize2();
                    var scale      = ViewPortSpatialTransform.Scale;
                    if (FloatComparer.AreEqual(0, scale))
                    {
                        scale = 1;
                    }

                    camera.SetParallelScale(0.5 * clientSize.Height / scale);

                    var cameraDistance = GetNominalCameraDistance();
                    var pos            = ViewPortSpatialTransform.ConvertToSource(new PointF(clientSize.Width / 2f, clientSize.Height / 2f));
                    camera.SetPosition(pos.X, pos.Y, cameraDistance);
                    camera.SetFocalPoint(pos.X, pos.Y, 0);
                    camera.SetClippingRange(10, 2 * cameraDistance);
                    camera.ComputeViewPlaneNormal();

                    var up = ViewPortSpatialTransform.ConvertToSource(new SizeF(0, -1));
                    camera.SetViewUp(up.Width, up.Height, 0);

                    mTime = camera.GetMTime();
                }

            var rootProp = ModelRootProp;

            using (var vtkTransform = rootProp.GetUserMatrix())
            {
                var modelCumulativeTransform = GetModelCumulativeTransform();
                vtkTransform.SetElements(modelCumulativeTransform);
            }

            UpdateModelRootProp(rootProp);

            var propMTime = rootProp.GetMTime();

            if (mTime < propMTime)
            {
                mTime = propMTime;
            }

            if (_lastMTime < mTime)
            {
                _lastMTime = mTime;
                Modified();
            }
        }
Exemple #19
0
        private static IGraphic CreatePolyline(IList <PointF> vertices)
        {
            var closed   = FloatComparer.AreEqual(vertices[0], vertices[vertices.Count - 1]);
            var polyline = new PolylineGraphic(closed);

            polyline.Points.AddRange(vertices);
            return(polyline);
        }
 private static bool IsClosed(IPointsGraphic g)
 {
     if (g.Points.Count > 2)
     {
         return(FloatComparer.AreEqual(g.Points[0], g.Points[g.Points.Count - 1]));
     }
     return(false);
 }
Exemple #21
0
        private static void VerifyPointOnEllipse(float a, float b, PointF center, PointF intersection)
        {
            float x = intersection.X - center.X;
            float y = intersection.Y - center.Y;

            float rule = x * x / (a * a) + y * y / (b * b);

            Assert.IsTrue(FloatComparer.AreEqual(1F, rule), "Point is not on ellipse!");
        }
            public override bool Equals(object obj)
            {
                var other = (ItemKey)obj;

                return(other.Name == Name &&
                       other.Style == Style &&
                       other.Unit == Unit &&
                       FloatComparer.AreEqual(other.Size, Size));
            }
            /// <summary>
            /// Performs a hit test on the snap graphic at given point.
            /// </summary>
            /// <param name="point">The mouse position in destination coordinates.</param>
            /// <returns>
            /// <b>True</b> if <paramref name="point"/> is inside the snap graphic's radius, <b>false</b> otherwise.
            /// </returns>
            public override bool HitTest(Point point)
            {
                base.CoordinateSystem = CoordinateSystem.Source;
                bool result = FloatComparer.IsLessThan((float)Vector.Distance(base.SpatialTransform.ConvertToSource(point), this.Location), this.Radius);

                base.ResetCoordinateSystem();

                return(result);
            }
        public override bool CalculateCalloutLocation(out PointF location, out CoordinateSystem coordinateSystem)
        {
            if (this.Roi.Points.Count < 3 || string.IsNullOrEmpty(this.Callout.Text))
            {
                base.Callout.Visible = false;
            }
            else
            {
                base.Callout.Visible = true;
            }

            if (!base.Callout.Visible || _userMovedCallout)
            {
                return(base.CalculateCalloutLocation(out location, out coordinateSystem));
            }

            SizeF calloutOffsetDestination = GetCalloutOffsetDestination();

            coordinateSystem = CoordinateSystem.Destination;
            base.AnnotationGraphic.CoordinateSystem = coordinateSystem;

            // first, move the callout by the same amount the vertex moved (if it moved at all).
            location = base.Callout.TextLocation + calloutOffsetDestination;

            PointF start  = this.Roi.Points[0];
            PointF vertex = this.Roi.Points[1];
            PointF end    = this.Roi.Points[2];

            base.AnnotationGraphic.ResetCoordinateSystem();

            double vectorAngle = -Vector.SubtendedAngle(start, vertex, end) / 2 + 180;

            PointF[] points = new PointF[] { start, end };

            using (Matrix rotation = new Matrix())
            {
                rotation.Rotate((float)vectorAngle);
                rotation.Translate(-vertex.X, -vertex.Y);
                rotation.TransformPoints(points);
            }

            float calloutMagnitude = new Vector3D(location.X - vertex.X, location.Y - vertex.Y, 0).Magnitude;

            Vector3D startVector = new Vector3D(points[0].X, points[0].Y, 0);

            if (FloatComparer.AreEqual(startVector.Magnitude, 0F, 0.01F))
            {
                startVector = new Vector3D(-1, 0, 0);
            }

            startVector = startVector / startVector.Magnitude * calloutMagnitude;

            location = new PointF(startVector.X + vertex.X, startVector.Y + vertex.Y);

            return(true);
        }
        public bool IsOrthogonalTo(DicomImagePlane other, float angleTolerance)
        {
            angleTolerance = Math.Abs(angleTolerance);
            float upper = (float)Math.PI / 2 + angleTolerance;
            float lower = (float)Math.PI / 2 - angleTolerance;

            float angle = GetAngleBetween(other);

            return(FloatComparer.IsGreaterThan(angle, lower) && FloatComparer.IsLessThan(angle, upper));
        }
        public void TestNormalize()
        {
            Vector3D v1 = new Vector3D(2.2F, -6.1F, 7.4F);

            Assert.IsTrue(FloatComparer.AreEqual(v1.Magnitude, 9.8392072851F));

            Vector3D normalized = v1.Normalize();

            Assert.IsTrue(FloatComparer.AreEqual(normalized.Magnitude, 1.0F));
        }
Exemple #27
0
    public static int constructor(IntPtr l)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(l);
            if (num == 1)
            {
                FloatComparer o = new FloatComparer();
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, o);
                result = 2;
            }
            else if (LuaObject.matchType(l, num, 2, typeof(bool)))
            {
                bool relative;
                LuaObject.checkType(l, 2, out relative);
                FloatComparer o = new FloatComparer(relative);
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, o);
                result = 2;
            }
            else if (LuaObject.matchType(l, num, 2, typeof(float)))
            {
                float error;
                LuaObject.checkType(l, 2, out error);
                FloatComparer o = new FloatComparer(error);
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, o);
                result = 2;
            }
            else if (num == 3)
            {
                float error2;
                LuaObject.checkType(l, 2, out error2);
                bool relative2;
                LuaObject.checkType(l, 3, out relative2);
                FloatComparer o = new FloatComparer(error2, relative2);
                LuaObject.pushValue(l, true);
                LuaObject.pushValue(l, o);
                result = 2;
            }
            else
            {
                result = LuaObject.error(l, "New object failed.");
            }
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemple #28
0
 public bool IsEqualTo(double value, double tolerance)
 {
     if (FloatComparer.AreEqual((float)this.Mean, (float)value, (float)tolerance))
     {
         if (FloatComparer.AreEqual((float)this.StandardDeviation, 0, (float)tolerance))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #29
0
        public void TestMinorAxisZero()
        {
            float  a      = 2.5F;
            float  b      = 0F;
            PointF center = new PointF(3F, 2F);
            PointF test   = new PointF(13F, 7F);

            PointF intersection = EllipsePrimitive.IntersectEllipseAndLine(a, b, center, test);

            //intersection is at center.
            Assert.IsTrue(FloatComparer.AreEqual(center, intersection), "ellipse intersection point is not correct!");
        }
Exemple #30
0
        public void TestPointVeryCloseToZero()
        {
            float  a      = 2.5F;
            float  b      = 1.25F;
            PointF center = new PointF(3F, 2F);
            PointF test   = new PointF(3.0001F, 2.0001F);

            PointF intersection = EllipsePrimitive.IntersectEllipseAndLine(a, b, center, test);

            //intersection is at center.
            Assert.IsTrue(FloatComparer.AreEqual(center, intersection), "ellipse intersection point is not correct!");
        }