Exemplo n.º 1
0
        public virtual bool IsOnLine(CartesianPoint pointToCheck)
        {
            GeometricVector normalizedVector     = Vector.Normalize(2);
            GeometricVector vectorToPointToCheck = this.PointOnLine.VectorTo(pointToCheck);

            vectorToPointToCheck = vectorToPointToCheck.Normalize(2);
            if (normalizedVector.Equals(vectorToPointToCheck))
            {
                return(true);
            }

            GeometricVector inversedNormalizedVector = normalizedVector.Negate();

            return(inversedNormalizedVector.Equals(vectorToPointToCheck));
        }
Exemplo n.º 2
0
        public override bool IsOnLine(CartesianPoint pointToCheck)
        {
            GeometricVector normalizedVector = this.Vector.Normalize(2);

            GeometricVector vectorToPointToCheck = this.Start.VectorTo(pointToCheck);

            if (vectorToPointToCheck.X == 0 && vectorToPointToCheck.Y == 0 && vectorToPointToCheck.Z == 0)
            {
                // the pointToCheck is at the start of the bounded line
                return(true);
            }

            GeometricVector normalizedVectorToPointToCheck = vectorToPointToCheck.Normalize(2);

            if (!normalizedVector.Equals(normalizedVectorToPointToCheck))
            {
                return(false);
            }

            double norm = this.Vector.Norm(2);
            double normToPointToCheck = vectorToPointToCheck.Norm(2);

            return(normToPointToCheck <= norm);
        }