//=========================================================================== // GoTools Core - SINTEF Geometry Tools Core library, version 2.0.1 // // Copyright (C) 2000-2007, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //=========================================================================== 00084 #ifndef _MSC_VER // Getting rid of warning C4996 on Windows 00085 std::copy(v.begin(), v.end(), pstart_); 00086 #else 00087 stdext::unchecked_copy(v.begin(), v.end(), pstart_); 00088 #endif // _MSC_VER 00089 }

template<typename RandomAccessIterator >
Go::Point::Point ( RandomAccessIterator  first,
RandomAccessIterator  last 
) [inline]

Constructor making a Point from an iterator range.

Definition at line 94 of file Point.h.

00095         : pstart_(0), n_(last - first), owns_(true)
00096     {
00097         pstart_ = new double[n_];
00098 #ifndef _MSC_VER // Getting rid of warning C4996 on Windows
00099         std::copy(first, last, pstart_);
00100 #else
00101         stdext::unchecked_copy(first, last, pstart_);
00102 #endif // _MSC_VER
00103     }

Go::Point::Point ( double *  begin,
double *  end,
bool  own 
) [inline]

Make a point from an existing range of doubles.

If the own parmeter is false, the Point will refer to the input data, and not own them. If it is true, it will act as a regular point, owning its data.

Definition at line 134 of file Point.h.

00135         : pstart_(0), n_(end-begin), owns_(own)
00136     {
00137         if (owns_) {
00138             pstart_ = new double[n_];
00139 #ifndef _MSC_VER // Getting rid of warning C4996 on Windows
00140             std::copy(begin, end, pstart_);
00141 #else
00142             stdext::unchecked_copy(begin, end, pstart_);
00143 #endif // _MSC_VER
00144         } else {
00145             pstart_ = begin;
00146         }
00147     }

Go::Point::Point ( const Point v  )  [inline]

Copy constructor.

Definition at line 150 of file Point.h.

References pstart_.

00151         : pstart_(0), n_(v.n_), owns_(true)
00152     {
00153         pstart_ = new double[n_];
00154 #ifndef _MSC_VER // Getting rid of warning C4996 on Windows
00155         std::copy(v.pstart_, v.pstart_ + n_, pstart_);
00156 #else
00157         stdext::unchecked_copy(v.pstart_, v.pstart_ + n_, pstart_);
00158 #endif // _MSC_VER
00159     }

Go::Point::~Point (  )  [inline]

Destructor.

Definition at line 170 of file Point.h.

00171     {
00172         if (owns_) delete [] pstart_;
00173     }


Member Function Documentation

double Go::Point::angle ( const Point v  )  const [inline]

The angle between this and another vector. Range is [0.0, M_PI].

Definition at line 477 of file Point.h.

Referenced by Go::CrossTanOffDist::approximationOK(), Go::CrossTangentOffset::approximationOK(), Go::Parabola::directionCone(), Go::Hyperbola::directionCone(), Go::Ellipse::directionCone(), Go::IntCrvEvaluator::evaluate(), Go::Plane::intersect(), main(), Go::Torus::normalCone(), Go::CreatorsUtils::projectCurvePoint(), and Go::surfaceKinks().

00478     {
00479         return acos(cosAngle(v));
00480     }

double Go::Point::angle_smallest ( const Point v  )  const [inline]

The smallest angle between this and another vector regardless of orientation.

Range is [0.0, 0.5*M_PI].

Definition at line 484 of file Point.h.

References length().

Referenced by Go::extremalPtSurfSurf(), Go::getGnJoints(), Go::CreatorsUtils::projectCurvePoint(), and Go::BoundedUtils::translatePlaneToCurves().

00485     {
00486         double tl1 = length();
00487         double tl2 = v.length();
00488         //DEBUG_ERROR_IF(tl1*tl2 == 0.0, "Vector of zero length");
00489         double tcos = fabs(((*this)*v)/(tl1*tl2));
00490         tcos = std::min(1.0, tcos);
00491         return acos(tcos);
00492     }

double* Go::Point::begin (  )  [inline]

Get a start iterator.

Definition at line 202 of file Point.h.

00202 { return pstart_; }

const double* Go::Point::begin (  )  const [inline]

Get a read-only start iterator.

Definition at line 200 of file Point.h.

Referenced by Go::CurveBoundedDomain::closestInDomain(), Go::CurveBoundedDomain::closestOnBoundary(), Go::SplineSurface::closestPoint(), Go::CreatorsUtils::createCrossTangent(), Go::ProjectCurveAndCrossTan::createSeed(), Go::ProjectCurve::createSeed(), Go::CurveOnSurface::ensureParCrvExistence(), Go::SmoothTransition::eval(), Go::TrimCurve::evaluate(), Go::SpaceIntCrv::evaluate(), Go::IntCrvEvaluator::evaluate(), Go::FunctionMinimizer< Functor >::fval(), Go::FunctionMinimizer< Functor >::getPar(), Go::SmoothTransition::getSuggestedSurfaceParameter(), Go::ProjectIntersectionCurve::getSuggestedSurfaceParameter(), Go::HermiteGrid1DMulti::HermiteGrid1DMulti(), Go::AdaptCurve::initSamples(), Go::intersectCurvePoint(), Go::SplineSurface::isDegenerate(), Go::make_trimmed_mesh(), Go::SmoothTransition::offsetIntersectionIterate(), Go::SmoothTransition::offsetIntersectionPoints(), Go::rotateLineCloud(), Go::rotatePoint(), Go::ParamCurve::s1771(), Go::FunctionMinimizer< Functor >::scalarProductSign(), Go::CurveOnSurface::subCurve(), Go::surfaceKinks(), and Go::ParametricSurfaceTesselator::tesselate().

00200 { return pstart_; }

double Go::Point::cosAngle ( const Point v  )  const [inline]

The cosine of the angle between this and another vector.

Definition at line 461 of file Point.h.

References length().

Referenced by Go::SplineSurface::normalCone(), and Go::CreatorsUtils::projectCurvePoint().

00462     {
00463         double tl1 = length();
00464         double tl2 = v.length();
00465         //(DEBUG_ERROR_IF(tl1*tl2 == 0.0, "Vector of zero length");
00466         if (tl1*tl2 == 0.0) 
00467         {
00468             //MESSAGE("Vector of zero length in angle compuation");
00469             return 0.0;
00470         }
00471         double res = ((*this)*v)/(tl1*tl2);
00472         res = std::min(1.0, std::max(-1.0, res));
00473         return res;
00474     }

Point Go::Point::cross ( const Point v  )  const [inline]

The cross product of two vectors.

Throws if dimensions are not 3.

Definition at line 434 of file Point.h.

Referenced by Go::Circle::closestPoint(), Go::closestPtCurveSurf(), Go::Sphere::getLongitudinalCircle(), Go::Torus::getMinorCircle(), Go::make_trimmed_mesh(), Go::Torus::setCoordinateAxes(), Go::Sphere::setCoordinateAxes(), Go::Disc::setCoordinateAxes(), Go::Cylinder::setCoordinateAxes(), Go::Cone::setCoordinateAxes(), Go::Plane::setSpanningVectors(), Go::Parabola::setSpanningVectors(), Go::Hyperbola::setSpanningVectors(), Go::Ellipse::setSpanningVectors(), Go::Circle::setSpanningVectors(), Go::Cylinder::tangentCone(), Go::Cone::tangentCone(), and Go::BoundedUtils::translatePlaneToCurves().

00435     {
00436         return operator%(v);
00437     }

int Go::Point::dimension (  )  const [inline]

Get the dimension of the Point. Same as size().

Definition at line 210 of file Point.h.

Referenced by Go::DirectionCone::addUnionWith(), Go::BoundingBox::addUnionWith(), Go::BoundingBox::check(), Go::Circle::Circle(), Go::Cone::Cone(), Go::CurveCreators::createCircle(), Go::Cylinder::Cylinder(), Go::Torus::dimension(), Go::Sphere::dimension(), Go::Plane::dimension(), Go::Parabola::dimension(), Go::Line::dimension(), Go::Hyperbola::dimension(), Go::Ellipse::dimension(), Go::Disc::dimension(), Go::Cylinder::dimension(), Go::Cone::dimension(), Go::Circle::dimension(), Go::Ellipse::Ellipse(), Go::CrossTanOffDist::eval(), Go::CrossTangentOffset::eval(), Go::CrossTanOffDist::evalblend(), Go::CrossTanOffDist::evaldiff(), Go::getRotationMatrix(), Go::Hyperbola::Hyperbola(), Go::SweepSurfaceCreator::linearSweptSurface(), Go::operator<(), Go::Parabola::Parabola(), Go::Plane::Plane(), Go::projectCurve(), Go::DirectionCone::read(), Go::BoundingBox::read(), Go::rotateLineCloud(), Go::rotatePoint(), Go::rotateSplineCurve(), Go::rotateSplineSurf(), Go::SweepSurfaceCreator::rotationalSweptSurface(), Go::Parabola::setSpanningVectors(), Go::Hyperbola::setSpanningVectors(), Go::Ellipse::setSpanningVectors(), Go::Circle::setSpanningVectors(), Go::Sphere::Sphere(), Go::SplineCurve::SplineCurve(), Go::Torus::Torus(), Go::translateSplineCurve(), and Go::translateSplineSurf().

00210 { return n_; }

double Go::Point::dist ( const Point v  )  const [inline]

Get the euclidian length of the difference between this vector and another vector.

Definition at line 305 of file Point.h.

Referenced by Go::TrimCurve::approximationOK(), Go::ProjectIntersectionCurve::approximationOK(), Go::ProjectCurve::approximationOK(), Go::LiftCurve::approximationOK(), Go::IntCrvEvaluator::approximationOK(), Go::CrossTanOffDist::approximationOK(), Go::CrossTangentOffset::approximationOK(), Go::ApproxSurf::checkAccuracy(), Go::BoundedSurface::closestBoundaryPoint(), Go::SplineSurface::closestPoint(), Go::BoundedSurface::closestPoint(), Go::closestPtSislCurves(), Go::computeLoopGap(), Go::cornerToCornerSfs(), Go::CurveOnSurface::CurveOnSurface(), Go::SplineCurve::derivCurve(), Go::ParamCurve::estimatedCurveLength(), Go::estimateIsoCurveLength(), Go::estimateSurfaceSize(), Go::CreatorsUtils::fixTrimCurves(), Go::BoundedUtils::intersectWithSurface(), Go::isCoincident(), Go::SplineCurve::isDegenerate(), Go::CurveOnSurface::isDegenerate(), Go::CurveBoundedDomain::isOnCorner(), Go::iterateCornerPos(), main(), Go::orientCurves(), Go::CreatorsUtils::projectCurvePoint(), Go::SmoothTransition::projectPoint(), Go::ParamCurve::s1771(), Go::CurveOnSurface::sameCurve(), Go::CurveOnSurface::sameOrientation(), Go::SplineCurve::SplineCurve(), Go::CurveOnSurface::subCurve(), and Go::surfaceKinks().

00306     {
00307         return sqrt(dist2(v));
00308     }

double Go::Point::dist2 ( const Point v  )  const [inline]

Get the square of the euclidian length of the difference between this vector and another vector.

Definition at line 292 of file Point.h.

References pstart_.

Referenced by test_pt().

00293     {
00294         double l2 = 0;
00295         double d;
00296         for (int i = 0; i < n_; ++i) {
00297             d = pstart_[i] - v.pstart_[i];
00298             l2 += d*d;
00299         }
00300         return l2;
00301     }

double Go::Point::distInf ( const Point v  )  const [inline]

Get the infinity-norm (or max-norm) length of the difference between this vector and another vector.

Definition at line 312 of file Point.h.

References pstart_.

00313     {
00314         double linf = 0;
00315         double d;
00316         for (int i = 0; i < n_; ++i) {
00317             d = pstart_[i] - v.pstart_[i];
00318             linf = std::max(linf, fabs(d));
00319         }
00320         return linf;
00321     }

double* Go::Point::end (  )  [inline]

Get a end iterator.

Definition at line 206 of file Point.h.

00206 { return pstart_ + n_; }

const double* Go::Point::end (  )  const [inline]

Get a read-only end iterator.

Definition at line 204 of file Point.h.

Referenced by Go::CreatorsUtils::createCrossTangent(), Go::ProjectCurveAndCrossTan::createSeed(), Go::ProjectCurve::createSeed(), Go::CurveOnSurface::ensureParCrvExistence(), Go::SmoothTransition::eval(), Go::SmoothTransition::getSuggestedSurfaceParameter(), Go::ProjectIntersectionCurve::getSuggestedSurfaceParameter(), Go::HermiteGrid1DMulti::HermiteGrid1DMulti(), Go::AdaptCurve::initSamples(), Go::SplineSurface::isDegenerate(), Go::SmoothTransition::offsetIntersectionPoints(), Go::FunctionMinimizer< Functor >::scalarProductSign(), Go::surfaceKinks(), and Go::ParametricSurfaceTesselator::tesselate().

00204 { return pstart_ + n_; }

double Go::Point::length (  )  const [inline]

Get the euclidian length of the vector.

Definition at line 275 of file Point.h.

Referenced by Go::DirectionCone::addUnionWith(), angle_smallest(), Go::SplineSurface::areaDiagonalCross(), Go::SmoothTransition::blend_s1421(), Go::Circle::closestPoint(), Go::closestPtSurfSurfPlaneGeometrical(), Go::SmoothTransition::computeCrosstangentValues(), cosAngle(), Go::CreatorsUtils::createCrossTangent(), Go::CrossTangentOffset::CrossTangentOffset(), Go::CrossTanOffDist::CrossTanOffDist(), Go::DirectionCone::DirectionCone(), Go::ProjectCurveAndCrossTan::eval(), Go::CrossTanOffDist::eval(), Go::CrossTangentOffset::eval(), Go::SpaceIntCrv::evaluate(), Go::getGnJoints(), Go::Parabola::isDegenerate(), Go::Line::isDegenerate(), Go::Hyperbola::isDegenerate(), Go::Ellipse::isDegenerate(), Go::Line::length(), Go::make_trimmed_mesh(), Go::minimalCurvatureRadius(), Go::nextStep(), Go::SplineSurface::normal_not_failsafe(), Go::SplineSurface::normalCone(), Go::SmoothTransition::offsetIntersectionIterate(), Go::SmoothTransition::offsetIntersectionPoints(), Go::SweepSurfaceCreator::rotationalSweptSurface(), Go::Torus::setCoordinateAxes(), Go::Sphere::setCoordinateAxes(), Go::Disc::setCoordinateAxes(), Go::Cylinder::setCoordinateAxes(), Go::Cone::setCoordinateAxes(), Go::DirectionCone::setFromArray(), Go::Plane::setSpanningVectors(), Go::Parabola::setSpanningVectors(), Go::Hyperbola::setSpanningVectors(), Go::Ellipse::setSpanningVectors(), Go::Circle::setSpanningVectors(), and Go::SplineSurface::tangentCone().

00276     {
00277         return sqrt(length2());
00278     }

double Go::Point::length2 (  )  const [inline]

Get the square of the euclidian length of the vector.

Definition at line 266 of file Point.h.

Referenced by Go::curvatureRadiusPoints(), and Go::minimise_conjugated_gradient().

00267     {
00268         double l2 = 0;
00269         for (int i = 0; i < n_; ++i)
00270             l2 += pstart_[i]*pstart_[i];
00271         return l2;
00272     }

double Go::Point::lengthInf (  )  const [inline]

Get the infinity-norm (or max-norm) length of the vector.

Definition at line 281 of file Point.h.

Referenced by Go::FunctionMinimizer< Functor >::orientDirection().

00282     {
00283         double linf = 0;
00284         for (int i = 0; i < n_; ++i) {
00285             linf = std::max(linf, fabs(pstart_[i]));
00286         }
00287         return linf;
00288     }

void Go::Point::normalize (  )  [inline]

Normalize this vector, i.e.

divide every element by length().

Definition at line 324 of file Point.h.

References DEBUG_ERROR_IF.

Referenced by Go::DirectionCone::addUnionWith(), Go::Circle::Circle(), Go::Line::closestPoint(), Go::SmoothTransition::computeCrosstangentValues(), Go::CurveCreators::createCircle(), Go::CreatorsUtils::createCrossTangent(), Go::Ellipse::Ellipse(), Go::SmoothTransition::eval(), Go::ProjectCurveAndCrossTan::eval(), Go::TrimCurve::evaluate(), Go::SpaceIntCrv::evaluate(), Go::IntCrvEvaluator::evaluate(), Go::extremalPtSurfSurf(), Go::SplineSurface::gridEvaluator(), Go::Hyperbola::Hyperbola(), Go::SplineSurface::mirrorSurface(), Go::SmoothTransition::offsetIntersectionPoints(), Go::Parabola::Parabola(), Go::projectCurve(), Go::Ellipse::read(), Go::Circle::read(), Go::rotateLineCloud(), Go::rotatePoint(), Go::rotateSplineCurve(), Go::rotateSplineSurf(), Go::Torus::setCoordinateAxes(), Go::Sphere::setCoordinateAxes(), Go::Disc::setCoordinateAxes(), Go::Cylinder::setCoordinateAxes(), Go::Cone::setCoordinateAxes(), Go::RotatedBox::setCs(), Go::DirectionCone::setFromArray(), Go::Plane::setSpanningVectors(), Go::Parabola::setSpanningVectors(), Go::Hyperbola::setSpanningVectors(), Go::Ellipse::setSpanningVectors(), and Go::Circle::setSpanningVectors().

00325     {
00326         double tl = length();
00327         DEBUG_ERROR_IF(tl == 0.0, "Cannot normalize vector of zero length");
00328         (*this) /= tl;
00329     }

double Go::Point::normalize_checked (  )  [inline]

Definition at line 331 of file Point.h.

00332     {
00333         double tl = length(); 
00334         if (tl<1.0e-12)
00335             return 0;
00336 
00337         (*this) /= tl; 
00338         return tl;
00339     }

Point Go::Point::operator% ( const Point v  )  const [inline]

The cross product of two vectors.

Dimensions should be 3.

Definition at line 423 of file Point.h.

References DEBUG_ERROR_IF, n_, and pstart_.

00424     {
00425         DEBUG_ERROR_IF(n_ != 3 || v.n_ != 3,
00426                  "Dimension mismatch.");
00427         return Point(pstart_[1]*v.pstart_[2] - pstart_[2]*v.pstart_[1],
00428                      pstart_[2]*v.pstart_[0] - pstart_[0]*v.pstart_[2],
00429                      pstart_[0]*v.pstart_[1] - pstart_[1]*v.pstart_[0]);
00430     }

double Go::Point::operator* ( const Point v  )  const [inline]

The scalar product (or inner product, or dot product) of two vectors.

Definition at line 411 of file Point.h.

References DEBUG_ERROR_IF, n_, and pstart_.

00412     {
00413         DEBUG_ERROR_IF(n_!=v.n_,
00414                  "Dimension mismatch.");
00415         double res = 0;
00416         for (int i = 0; i < n_; ++i)
00417             res += pstart_[i]*v.pstart_[i];
00418         return res;
00419     }

Point Go::Point::operator* ( double  d  )  const [inline]

The product of a vector and a scalar.

Definition at line 373 of file Point.h.

00374     {
00375         Point res(*this);
00376         res *= d;
00377         return res;
00378     }

void Go::Point::operator*= ( double  d  )  [inline]

Multiply this vector by a scalar.

Definition at line 380 of file Point.h.

00381     {
00382         for (int i = 0; i < n_; ++i)
00383             pstart_[i] *= d;
00384     }

Point Go::Point::operator+ ( const Point v  )  const [inline]

The sum of two vectors.

Definition at line 342 of file Point.h.

00343     {
00344         Point res(*this);
00345         res += v;
00346         return res;
00347     }

void Go::Point::operator+= ( const Point v  )  [inline]

Add a vector to this vector.

Definition at line 349 of file Point.h.

References DEBUG_ERROR_IF, n_, and pstart_.

00350     {
00351         DEBUG_ERROR_IF(n_!=v.n_,
00352                  "Dimension mismatch.");
00353         for (int i = 0; i < n_; ++i)
00354             pstart_[i] += v.pstart_[i];
00355     }

Point Go::Point::operator- (  )  const [inline]

The negation of a vector.

Definition at line 401 of file Point.h.

References pstart_.

00402     {
00403         Point res(*this);
00404         for (int i = 0; i < n_; ++i)
00405             res.pstart_[i] = - pstart_[i];
00406         return res;
00407     }

Point Go::Point::operator- ( const Point v  )  const [inline]

The difference between two vectors.

Definition at line 358 of file Point.h.

00359     {
00360         Point res(*this);
00361         res -= v;
00362         return res;
00363     }

void Go::Point::operator-= ( const Point v  )  [inline]

Subtract a vector from this vector.

Definition at line 365 of file Point.h.

References DEBUG_ERROR_IF, n_, and pstart_.

00366     {
00367         DEBUG_ERROR_IF(n_!=v.n_,
00368                  "Dimension mismatch.");
00369         for (int i = 0; i < n_; ++i)
00370             pstart_[i] -= v.pstart_[i];
00371     }

Point Go::Point::operator/ ( double  d  )  const [inline]

A vector divided by a scalar.

Definition at line 387 of file Point.h.

00388     {
00389         Point res(*this);
00390         res /= d;
00391         return res;
00392     }

void Go::Point::operator/= ( double  d  )  [inline]

Divide this vector with a scalar.

Definition at line 394 of file Point.h.

00395     {
00396         for (int i = 0; i < n_; ++i)
00397             pstart_[i] /= d;
00398     }

Point& Go::Point::operator= ( const Point v  )  [inline]

Assignment operator.

Definition at line 162 of file Point.h.

00163     {
00164         Point temp(v);
00165         swap(temp);
00166         return *this;
00167     }

double& Go::Point::operator[] ( int  i  )  [inline]

Index access.

Definition at line 198 of file Point.h.

00198 { return pstart_[i]; }

const double& Go::Point::operator[] ( int  i  )  const [inline]

Read-only index access.

Definition at line 196 of file Point.h.

00196 { return pstart_[i]; }

void Point::read ( std::istream &  is  ) 

Reads a Point elementwise from a standard istream.

The Point must already be initialized with the correct dimension.

Definition at line 22 of file Point.C.

References ALWAYS_ERROR_IF, n_, and pstart_.

Referenced by Go::operator>>().

00024 {
00025     ALWAYS_ERROR_IF (n_ == 0,
00026                      "Trying to read into an 0-dimensional (empty) point.");
00027     for (int i = 0; i < n_; ++i)
00028         is >> pstart_[i];
00029 }

void Go::Point::resetValue ( int  idx,
double  val 
) [inline]

Definition at line 257 of file Point.h.

References DEBUG_ERROR_IF.

00258         {
00259             DEBUG_ERROR_IF(idx < 0 || idx >= n_,
00260                  "Dimension mismatch.");
00261             pstart_[idx] = val;
00262         }

void Go::Point::resize ( int  d  )  [inline]

Changing dimension. This loses all info in the point.

Definition at line 213 of file Point.h.

Referenced by Go::ProjectIntersectionCurve::eval(), main(), Go::Torus::read(), Go::Sphere::read(), Go::Plane::read(), Go::Line::read(), Go::Ellipse::read(), Go::Disc::read(), Go::Cylinder::read(), Go::Cone::read(), Go::Circle::read(), Go::BoundedCurve::read(), Go::Parabola::setSpanningVectors(), Go::Hyperbola::setSpanningVectors(), Go::Ellipse::setSpanningVectors(), Go::Circle::setSpanningVectors(), and Go::surfaceKinks().

00214     {
00215         if (n_ < d) {
00216             Point temp(d);
00217             swap(temp);
00218         } else {
00219             n_ = d;
00220         }
00221     }

void Go::Point::setToCrossProd ( const Point u,
const Point v 
) [inline]

Set this Point to the cross product of two other Points.

Definition at line 440 of file Point.h.

References DEBUG_ERROR_IF, n_, and pstart_.

00441     {
00442         DEBUG_ERROR_IF(u.n_!=v.n_,
00443                  "Dimension mismatch.");
00444         DEBUG_ERROR_IF(u.n_!=3,
00445                  "Dimension must be 3.");
00446 
00447         bool have_already = owns_ && (n_ >= v.n_);
00448         if (!have_already) {
00449             Point temp(3);
00450             swap(temp);
00451         } else {
00452             n_ = 3;
00453         }
00454         pstart_[0]=u.pstart_[1]*v.pstart_[2] - u.pstart_[2]*v.pstart_[1];
00455         pstart_[1]=u.pstart_[2]*v.pstart_[0] - u.pstart_[0]*v.pstart_[2];
00456         pstart_[2]=u.pstart_[0]*v.pstart_[1] - u.pstart_[1]*v.pstart_[0];
00457     }

void Go::Point::setValue ( double  val  )  [inline]

Set function that sets all elements equal to the input.

Dimension must already be initialized!

Definition at line 250 of file Point.h.

00251     {
00252         for (int i = 0; i < n_; ++i) {
00253             pstart_[i] = val;
00254         }
00255     }

void Go::Point::setValue ( const double *  array  )  [inline]

Set function that copies values from an input array.

Dimension must already be initialized!

Definition at line 241 of file Point.h.

00242     {
00243         for (int i = 0; i < n_; ++i) {
00244             pstart_[i] = array[i];
00245         }
00246     }

void Go::Point::setValue ( double  x,
double  y,
double  z 
) [inline]

Set function for 3D.

Definition at line 231 of file Point.h.

00232     {
00233         resize(3);
00234         pstart_[0] = x;
00235         pstart_[1] = y;
00236         pstart_[2] = z;
00237     }

void Go::Point::setValue ( double  x,
double  y 
) [inline]

Set function for 2D.

Definition at line 224 of file Point.h.

Referenced by Go::ApproxCurve::checkAccuracy(), Go::AdaptCurve::checkAccuracy(), Go::CrossTangentOffset::CrossTangentOffset(), Go::CrossTanOffDist::CrossTanOffDist(), Go::ProjectCurveAndCrossTan::eval(), Go::SmoothTransition::guessParameterPoints(), Go::HermiteInterpolator::interpolate(), Go::iterateCornerPos(), Go::make_trimmed_mesh(), Go::SmoothTransition::offsetIntersectionPoints(), Go::principalCurvatures(), Go::DirectionCone::setFromArray(), and Go::surfaceKinks().

00225     {
00226         resize(2);
00227         pstart_[0] = x;
00228         pstart_[1] = y;
00229     }

int Go::Point::size (  )  const [inline]

Get the dimension of the Point.

Definition at line 208 of file Point.h.

Referenced by Go::CurveBoundedDomain::closestInDomain(), Go::CurveBoundedDomain::closestOnBoundary(), Go::ProjectCurve::eval(), Go::intersectCurvePoint(), main(), Go::SplineSurface::normalCone(), Go::FunctionMinimizer< Functor >::numerical_tolerance(), Go::FunctionMinimizer< Functor >::numPars(), Go::RotatedBox::RotatedBox(), Go::RotatedBox::setFromPoints(), and Go::SplineSurface::tangentCone().

00208 { return n_; }

void Go::Point::swap ( Point other  )  [inline]

Swaps two Point instances. Never throws.

Definition at line 176 of file Point.h.

References n_, owns_, and pstart_.

Referenced by Go::closestPtSurfSurfPlaneGeometrical().

00177     {
00178         std::swap(pstart_, other.pstart_);
00179         std::swap(n_, other.n_);
00180         std::swap(owns_, other.owns_);
00181     }

void Point::write ( std::ostream &  os  )  const

Writes a Point elementwise to a standard ostream.

Precision is set to 16 by this function. Dimension is not stored.

Definition at line 33 of file Point.C.

Referenced by Go::operator<<().

00035 {
00036     std::streamsize prev = os.precision(16);
00037     for (int i = 0; i < n_-1; ++i)
00038         os << pstart_[i] << ' ';
00039     os << pstart_[n_-1];
00040     os.precision(prev);   // Reset precision to it's previous value
00041 }


Member Data Documentation

int Go::Point::n_ [private]

Definition at line 39 of file Point.h.

Referenced by operator%(), operator*(), operator+=(), operator-=(), read(), setToCrossProd(), and swap().

bool Go::Point::owns_ [private]

Definition at line 40 of file Point.h.

Referenced by swap().

double* Go::Point::pstart_ [private]

Definition at line 38 of file Point.h.

Referenced by dist2(), distInf(), operator%(), operator*(), operator+=(), operator-(), operator-=(), Point(), read(), setToCrossProd(), and swap().


The documentation for this class was generated from the following files:
Generated on Tue Sep 21 15:44:27 2010 for GoTools Core by  doxygen 1.6.3