Jpp  17.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Friends | List of all members
JGEOMETRY3D::JSegment3D Class Reference

Line segment in two dimensions. More...

#include <JSegment3D.hh>

Inheritance diagram for JGEOMETRY3D::JSegment3D:
std::pair< JFirst_t, JSecond_t >

Public Member Functions

 JSegment3D ()
 Default constructor. More...
 
 JSegment3D (const JVector3D &A, const JVector3D &B)
 Constructor. More...
 
double getLengthSquared () const
 Get length squared. More...
 
double getLength () const
 Get length. More...
 
double getDistanceSquared (const JVector3D &point, const double precision=1.0e-8) const
 Get squared of distance to point. More...
 
double getDistance (const JVector3D &point) const
 Get distance to point. More...
 
double getDot (const JSegment3D &segment) const
 Get dot product. More...
 

Friends

JReaderoperator>> (JReader &in, JSegment3D &segment)
 Read segment from input. More...
 
JWriteroperator<< (JWriter &out, const JSegment3D &segment)
 Write segment to output. More...
 

Detailed Description

Line segment in two dimensions.

Definition at line 33 of file JSegment3D.hh.

Constructor & Destructor Documentation

JGEOMETRY3D::JSegment3D::JSegment3D ( )
inline

Default constructor.

Definition at line 40 of file JSegment3D.hh.

40  :
41  JSegment3D_t()
42  {}
std::pair< JPosition3D, JPosition3D > JSegment3D_t
Type definition of line segment in two dimensions.
Definition: JSegment3D.hh:27
JGEOMETRY3D::JSegment3D::JSegment3D ( const JVector3D A,
const JVector3D B 
)
inline

Constructor.

Parameters
Astart position
Bend position

Definition at line 51 of file JSegment3D.hh.

52  :
53  JSegment3D_t(A,B)
54  {}
std::pair< JPosition3D, JPosition3D > JSegment3D_t
Type definition of line segment in two dimensions.
Definition: JSegment3D.hh:27

Member Function Documentation

double JGEOMETRY3D::JSegment3D::getLengthSquared ( ) const
inline

Get length squared.

Returns
square of length

Definition at line 62 of file JSegment3D.hh.

63  {
64  return JVector3D(this->second - this->first).getLengthSquared();
65  }
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
Data structure for vector in three dimensions.
Definition: JVector3D.hh:34
double getLengthSquared() const
Get length squared.
Definition: JVector3D.hh:235
double JGEOMETRY3D::JSegment3D::getLength ( ) const
inline

Get length.

Returns
length

Definition at line 73 of file JSegment3D.hh.

74  {
75  return sqrt(getLengthSquared());
76  }
double getLengthSquared() const
Get length squared.
Definition: JSegment3D.hh:62
double JGEOMETRY3D::JSegment3D::getDistanceSquared ( const JVector3D point,
const double  precision = 1.0e-8 
) const
inline

Get squared of distance to point.

Parameters
pointpoint
precisionprecision
Returns
square of distance

Definition at line 86 of file JSegment3D.hh.

87  {
88  JVector3D D(this->second - this->first);
89 
90  const double gp = D.getLengthSquared();
91 
92  if (gp > precision) {
93 
94  const JVector3D U(point - this->first);
95 
96  double u = D.getDot(U);
97 
98  if (u < 0.0)
99  u = 0.0;
100  else if (u > gp)
101  u = 1.0;
102  else
103  u /= gp;
104 
105  D.mul(u);
106  D.sub(U);
107 
108  return D.getLengthSquared();
109 
110  } else {
111 
112  return this->first.getDistanceSquared(point);
113  }
114  }
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
Data structure for vector in three dimensions.
Definition: JVector3D.hh:34
double u[N+1]
Definition: JPolint.hh:755
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
double JGEOMETRY3D::JSegment3D::getDistance ( const JVector3D point) const
inline

Get distance to point.

Parameters
pointpoint
Returns
distance

Definition at line 123 of file JSegment3D.hh.

124  {
125  return sqrt(getDistanceSquared(point));
126  }
double getDistanceSquared(const JVector3D &point, const double precision=1.0e-8) const
Get squared of distance to point.
Definition: JSegment3D.hh:86
double JGEOMETRY3D::JSegment3D::getDot ( const JSegment3D segment) const
inline

Get dot product.

Parameters
segmentsegment
Returns
dot product

Definition at line 135 of file JSegment3D.hh.

136  {
137  return JVector3D(this->second - this->first).getDot(segment.second - segment.first);
138  }
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
Data structure for vector in three dimensions.
Definition: JVector3D.hh:34
double getDot(const JVector3D &vector) const
Get dot product.
Definition: JVector3D.hh:282

Friends And Related Function Documentation

JReader& operator>> ( JReader in,
JSegment3D segment 
)
friend

Read segment from input.

Parameters
inreader
segmentsegment
Returns
reader

Definition at line 148 of file JSegment3D.hh.

149  {
150  in >> segment.first;
151  in >> segment.second;
152 
153  return in;
154  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
JWriter& operator<< ( JWriter out,
const JSegment3D segment 
)
friend

Write segment to output.

Parameters
outwriter
segmentsegment
Returns
writer

Definition at line 164 of file JSegment3D.hh.

165  {
166  out << segment.first;
167  out << segment.second;
168 
169  return out;
170  }

The documentation for this class was generated from the following file: