FEDEM Solver  R8.0
Source code of the dynamics solver
FFa3PArc.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
12 #ifndef FFA_3P_ARC_H
13 #define FFA_3P_ARC_H
14 
16 #include <array>
17 
18 class FaMat34;
19 
20 
26 class FFa3PArc
27 {
28 public:
30  FFa3PArc(const FaVec3& p1, const FaVec3& p2, const FaVec3& p3)
31  { P[0] = p1; P[1] = p2; P[2] = p3; }
32 
34  static FFa3PArc makeFromTangentP1P2(const FaVec3& t, const FaVec3& p1,
35  const FaVec3& p2, bool startTan = true);
37  static FFa3PArc makeFromP1T1T2L(const FaVec3& p1, const FaVec3& t1,
38  const FaVec3& t2, double arcLength);
39 
41  FaVec3 getCenter() const;
43  FaVec3 getNormal() const;
45  double getRadius() const;
46 
48  double getArcLength(double maxDeflection = 0.0) const;
50  FaVec3 getPointOnArc(double lengthFromStart) const;
52  FaVec3 getTangent(double lengthFromStart) const;
54  FaVec3 getSecant() const { return P.back() - P.front(); }
55 
57  const FaVec3& front() const { return P.front(); }
59  const FaVec3& back() const { return P.back(); }
60 
62  FaMat34 getCtrlPointMatrix(int pointNumber, const FaVec3& positiveNormal,
63  bool normalIsSignOnly = true) const;
64 
66  bool isArc(double epsilon = 1.0e-10) const;
68  bool isInside(const FaVec3& point) const;
69 
70 private:
71  std::array<FaVec3,3> P;
72 };
73 
74 #endif
Point vectors in 3D space.
Class representing a circular arc in 3D space.
Definition: FFa3PArc.H:27
FaVec3 getNormal() const
Returns the normal vector of the arc plane.
Definition: FFa3PArc.C:85
std::array< FaVec3, 3 > P
The three points defining this arc.
Definition: FFa3PArc.H:71
FaVec3 getTangent(double lengthFromStart) const
Returns the tangent vector at a given distance from the start.
Definition: FFa3PArc.C:254
FaVec3 getSecant() const
Returns the secant vector of the arc.
Definition: FFa3PArc.H:54
const FaVec3 & back() const
Returns the end point.
Definition: FFa3PArc.H:59
double getArcLength(double maxDeflection=0.0) const
Returns the length of the arc.
Definition: FFa3PArc.C:226
FaVec3 getPointOnArc(double lengthFromStart) const
Returns the point a given distance from the start point.
Definition: FFa3PArc.C:240
const FaVec3 & front() const
Returns the start point.
Definition: FFa3PArc.H:57
FFa3PArc(const FaVec3 &p1, const FaVec3 &p2, const FaVec3 &p3)
The constructor initializes the three points defining the arc.
Definition: FFa3PArc.H:30
double getRadius() const
Returns the radius of the arc.
Definition: FFa3PArc.C:94
bool isInside(const FaVec3 &point) const
Returns true if given point is inside the arc.
Definition: FFa3PArc.C:113
static FFa3PArc makeFromP1T1T2L(const FaVec3 &p1, const FaVec3 &t1, const FaVec3 &t2, double arcLength)
Creates an arc from an end point and two tangent vectors.
Definition: FFa3PArc.C:161
FaVec3 getCenter() const
Returns the centre point of the arc.
Definition: FFa3PArc.C:69
static FFa3PArc makeFromTangentP1P2(const FaVec3 &t, const FaVec3 &p1, const FaVec3 &p2, bool startTan=true)
Creates an arc from two end points and a tangent vector.
Definition: FFa3PArc.C:192
FaMat34 getCtrlPointMatrix(int pointNumber, const FaVec3 &positiveNormal, bool normalIsSignOnly=true) const
Returns the full position matrix for one of the arc points.
Definition: FFa3PArc.C:120
bool isArc(double epsilon=1.0e-10) const
Returns false if this arc is a straight line.
Definition: FFa3PArc.C:100
Definition: FFaMat34.H:16
Class for point vectors in 3D space.
Definition: FFaVec3.H:40