mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: vector mag(), magSqr() methods - complementary to dist(), distSqr()
ENH: use direct access to pointHit as point(), use dist(), distSqr() - if the pointHit has already been checked for hit(), can/should simply use point() noexcept access subsequently to avoid redundant checks. Using vector distSqr() methods provides a minor optimization (no itermediate temporary), but can also make for clearer code. ENH: copy construct pointIndexHit with different index - symmetric with constructing from a pointHit with an index STYLE: prefer pointHit point() instead of rawPoint()
This commit is contained in:
committed by
Andrew Heather
parent
5ec435aca3
commit
27c2cdc040
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -59,25 +59,25 @@ public:
|
||||
STLpoint() = default;
|
||||
|
||||
//- Construct from single-precision point
|
||||
inline STLpoint(const Vector<float>& p)
|
||||
STLpoint(const Vector<float>& p)
|
||||
:
|
||||
Vector<float>(p)
|
||||
{}
|
||||
|
||||
//- Construct from double-precision point
|
||||
inline STLpoint(const Vector<double>& p)
|
||||
STLpoint(const Vector<double>& p)
|
||||
:
|
||||
Vector<float>(float(p.x()), float(p.y()), float(p.z()))
|
||||
{}
|
||||
|
||||
//- Construct from single-precision components
|
||||
inline STLpoint(float x, float y, float z)
|
||||
STLpoint(float x, float y, float z)
|
||||
:
|
||||
Vector<float>(x, y, z)
|
||||
{}
|
||||
|
||||
//- Construct from double-precision components
|
||||
inline STLpoint(double x, double y, double z)
|
||||
STLpoint(double x, double y, double z)
|
||||
:
|
||||
Vector<float>(float(x), float(y), float(z))
|
||||
{}
|
||||
@ -87,7 +87,7 @@ public:
|
||||
|
||||
#ifdef WM_DP
|
||||
//- Conversion to double-precision point
|
||||
inline operator point() const
|
||||
operator point() const
|
||||
{
|
||||
return point(x(), y(), z());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user