Skip to content

Commit

Permalink
Review validity ranges for angle parameters
Browse files Browse the repository at this point in the history
Documentation has been updated accordingly.
  • Loading branch information
mrguilima committed Mar 26, 2024
1 parent 759f0ef commit 7a9c037
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/orange/orangeinp/ConvexRegion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void InfWedge::output(JsonPimpl* j) const
// PARALLELEPIPED
//---------------------------------------------------------------------------//
/*!
* Construct with a 3-vector of half-edges and three angles (in radians).
* Construct with a 3-vector of half-edges and three angles.
*/
Parallelepiped::Parallelepiped(Real3 const& half_projs,
Turn alpha,
Expand All @@ -373,13 +373,13 @@ Parallelepiped::Parallelepiped(Real3 const& half_projs,
<< to_char(ax) << " axis: " << hpr_[to_int(ax)]);
}

CELER_VALIDATE(alpha_ >= zero_quantity() && alpha_ < Turn{0.25},
CELER_VALIDATE(alpha_ > -Turn{0.25} && alpha_ < Turn{0.25},
<< "invalid angle " << alpha_.value()
<< " [turns]: must be in the range [0, 0.25]");
<< " [turns]: must be in the range (-0.25, 0.25)");

CELER_VALIDATE(theta_ >= zero_quantity() && theta_ < Turn{0.25},
<< "invalid angle " << theta_.value()
<< " [turns]: must be in the range [0, 0.25]");
<< " [turns]: must be in the range [0, 0.25)");

CELER_VALIDATE(phi_ >= zero_quantity() && phi_ < Turn{1.},
<< "invalid angle " << phi_.value()
Expand Down
16 changes: 9 additions & 7 deletions src/orange/orangeinp/ConvexRegion.hh
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,20 @@ class InfWedge final : public ConvexRegionInterface
* A parallelepiped is a shape having 3 pairs of parallel faces out of
* which one is parallel with the XY plane (Z faces). All faces are
* parallelograms in the general case. The Z faces have 2 edges parallel
* with the X-axis.
* with the X-axis. Note that all angle parameters are expressed in terms
* of fractions of a 360deg turn.
*
* The shape has the center in the origin and it is defined by:
*
* - `dX, dY, dZ:` half-lengths of the projections of the edges on X, Y
* and Z. The lower Z face is positioned at `-dZ`, while the upper at
* `+dZ`.
* - `halfedges:` a 3-vector (dY, dY, dZ) with half-lengths of the
* projections of the edges on X, Y, Z. The lower Z face is positioned at
* `-dZ`, and the upper one at `+dZ`.
* - `alpha:` angle between the segment defined by the centers of the
* X-parallel edges and Y axis `[-90,90]` in degrees;
* X-parallel edges and Y axis. Validity range is `(-1/4, 1/4)`;
* - `theta:` polar angle of the shape's main axis, e.g. the segment defined
* by the centers of the Z faces;
* - `phi:` azimuthal angle of the shape's main axis (explained above).
* by the centers of the Z faces. Validity range is `[0, 1/4)`;
* - `phi:` azimuthal angle of the shape's main axis (as explained above).
*   Validity range is `[0, 1)`.
*/
class Parallelepiped final : public ConvexRegionInterface
{
Expand Down

0 comments on commit 7a9c037

Please sign in to comment.