Real DistPoint2Line2<Real>::GetSquared (Real t,
    const Vector2<Real>& velocity0, const Vector2<Real>& velocity1)
{
    Vector2<Real> movedPoint = *mPoint + t*velocity0;
    Vector2<Real> movedOrigin = mLine->Origin + t*velocity1;
    Line2<Real> movedLine(movedOrigin, mLine->Direction);
    return DistPoint2Line2<Real>(movedPoint, movedLine).GetSquared();
}
示例#2
0
Real DistLine2Ray2<Real>::Get (Real t, const Vector2<Real>& velocity0,
    const Vector2<Real>& velocity1)
{
    Vector2<Real> movedOrigin0 = mLine->Origin + t*velocity0;
    Vector2<Real> movedOrigin1 = mRay->Origin + t*velocity1;
    Line2<Real> movedLine(movedOrigin0, mLine->Direction);
    Ray2<Real> movedRay(movedOrigin1, mRay->Direction);
    return DistLine2Ray2<Real>(movedLine, movedRay).Get();
}
Real DistLine2Segment2<Real>::GetSquared (Real t,
    const Vector2<Real>& velocity0, const Vector2<Real>& velocity1)
{
    Vector2<Real> movedOrigin = mLine->Origin + t*velocity0;
    Vector2<Real> movedCenter = mSegment->Center + t*velocity1;
    Line2<Real> movedLine(movedOrigin, mLine->Direction);
    Segment2<Real> movedSegment(movedCenter, mSegment->Direction,
        mSegment->Extent);
    return DistLine2Segment2<Real>(movedLine, movedSegment).GetSquared();
}
Real DistLine3Circle3<Real>::GetSquared (Real t,
    const Vector3<Real>& velocity0, const Vector3<Real>& velocity1)
{
    Vector3<Real> movedOrigin = mLine->Origin + t*velocity0;
    Vector3<Real> movedCenter = mCircle->Center + t*velocity1;
    Line3<Real> movedLine(movedOrigin, mLine->Direction);
    Circle3<Real> movedCircle(movedCenter, mCircle->Direction0,
        mCircle->Direction1, mCircle->Normal, mCircle->Radius);
    return DistLine3Circle3<Real>(movedLine, movedCircle).GetSquared();
}
Real DistLine3Rectangle3<Real>::GetSquared ( Real t,
        const Vector3<Real>& velocity0, const Vector3<Real>& velocity1 )
{
    Vector3<Real> movedOrigin = mLine->Origin + t * velocity0;
    Vector3<Real> movedCenter = mRectangle->Center + t * velocity1;
    Line3<Real> movedLine( movedOrigin, mLine->Direction );
    Rectangle3<Real> movedRectangle( movedCenter, mRectangle->Axis,
                                     mRectangle->Extent );
    return DistLine3Rectangle3<Real>( movedLine, movedRectangle ).GetSquared();
}
Real DistLine3Triangle3<Real>::GetSquared (Real t,
    const Vector3<Real>& velocity0, const Vector3<Real>& velocity1)
{
    Vector3<Real> movedOrigin = mLine->Origin + t*velocity0;
    Vector3<Real> movedV0 = mTriangle->V[0] + t*velocity1;
    Vector3<Real> movedV1 = mTriangle->V[1] + t*velocity1;
    Vector3<Real> movedV2 = mTriangle->V[2] + t*velocity1;
    Line3<Real> movedLine(movedOrigin, mLine->Direction);
    Triangle3<Real> movedTriangle(movedV0, movedV1, movedV2);
    return DistLine3Triangle3<Real>(movedLine, movedTriangle).GetSquared();
}