From c01469dddabe404506ef3a64542e8423f9e11f2c Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 30 Jan 2022 17:44:05 +0100 Subject: Converted Opcode and Ice into unix newlines format --- Opcode/Ice/IceSegment.cpp | 114 +++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 57 deletions(-) (limited to 'Opcode/Ice/IceSegment.cpp') diff --git a/Opcode/Ice/IceSegment.cpp b/Opcode/Ice/IceSegment.cpp index 189be8f..b45d04b 100644 --- a/Opcode/Ice/IceSegment.cpp +++ b/Opcode/Ice/IceSegment.cpp @@ -1,57 +1,57 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/** - * Contains code for segments. - * \file IceSegment.cpp - * \author Pierre Terdiman - * \date April, 4, 2000 - */ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/** - * IceSegment class. - * A segment is defined by S(t) = mP0 * (1 - t) + mP1 * t, with 0 <= t <= 1 - * Alternatively, a segment is S(t) = Origin + t * Direction for 0 <= t <= 1. - * Direction is not necessarily unit length. The end points are Origin = mP0 and Origin + Direction = mP1. - * - * \class IceSegment - * \author Pierre Terdiman - * \version 1.0 - */ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Precompiled Header -#include "StdAfx.h" - -using namespace IceMaths; - -float IceSegment::SquareDistance(const IcePoint& Point, float* t) const -{ - IcePoint Diff = Point - mP0; - IcePoint Dir = mP1 - mP0; - float fT = Diff | Dir; - - if(fT<=0.0f) - { - fT = 0.0f; - } - else - { - float SqrLen= Dir.SquareMagnitude(); - if(fT>=SqrLen) - { - fT = 1.0f; - Diff -= Dir; - } - else - { - fT /= SqrLen; - Diff -= fT*Dir; - } - } - - if(t) *t = fT; - - return Diff.SquareMagnitude(); -} +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * Contains code for segments. + * \file IceSegment.cpp + * \author Pierre Terdiman + * \date April, 4, 2000 + */ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +/** + * IceSegment class. + * A segment is defined by S(t) = mP0 * (1 - t) + mP1 * t, with 0 <= t <= 1 + * Alternatively, a segment is S(t) = Origin + t * Direction for 0 <= t <= 1. + * Direction is not necessarily unit length. The end points are Origin = mP0 and Origin + Direction = mP1. + * + * \class IceSegment + * \author Pierre Terdiman + * \version 1.0 + */ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Precompiled Header +#include "StdAfx.h" + +using namespace IceMaths; + +float IceSegment::SquareDistance(const IcePoint& Point, float* t) const +{ + IcePoint Diff = Point - mP0; + IcePoint Dir = mP1 - mP0; + float fT = Diff | Dir; + + if(fT<=0.0f) + { + fT = 0.0f; + } + else + { + float SqrLen= Dir.SquareMagnitude(); + if(fT>=SqrLen) + { + fT = 1.0f; + Diff -= Dir; + } + else + { + fT /= SqrLen; + Diff -= fT*Dir; + } + } + + if(t) *t = fT; + + return Diff.SquareMagnitude(); +} -- cgit v1.1