Belle II Software  release-08-01-10
LineSegment2D Class Reference

2D line segment. More...

#include <LineSegment2D.h>

Inheritance diagram for LineSegment2D:
Collaboration diagram for LineSegment2D:

Public Member Functions

 LineSegment2D (const HepGeom::Point3D< double > &point1, const HepGeom::Point3D< double > &point2)
 Constructor. More...
 
 ~LineSegment2D ()
 Destructor.
 
int findIntersection (const Line2D &line, HepGeom::Point3D< double > *intersection) const
 Find intersection with a line. More...
 
int findIntersection (const LineSegment2D &lineSegment, HepGeom::Point3D< double > *intersection) const
 Find intersection with a line segment. More...
 
int findIntersection (const Circle2D &circle, HepGeom::Point3D< double > intersections[2]) const
 Find intersections with a circle. More...
 
int findIntersection (const Arc2D &arc, HepGeom::Point3D< double > intersections[2]) const
 Find intersections with an arc. More...
 
bool tWithinRange (double t) const
 Check if t is within the line segment (0 <= t <= 1). More...
 
const HepGeom::Point3D< double > & getInitialPoint () const
 Get initial point.
 
const HepGeom::Vector3D< double > & getVector () const
 Get vector.
 
int findIntersection (const Line2D &line, HepGeom::Point3D< double > *intersection, double t[2]) const
 Find intersection with a line. More...
 

Protected Member Functions

int findIntersection (const Circle2D &circle, HepGeom::Point3D< double > intersections[2], double t[2], double angles[2]) const
 Find intersections with a circle. More...
 
int selectIntersections (HepGeom::Point3D< double > *intersections, bool *condition, int n) const
 Select intersections. More...
 

Protected Attributes

HepGeom::Point3D< double > m_Point
 Initial point.
 
HepGeom::Vector3D< double > m_Vector
 Vector.
 

Detailed Description

2D line segment.

Equation: m_Point + m_Vector * t, t = [0, 1].

Definition at line 28 of file LineSegment2D.h.

Constructor & Destructor Documentation

◆ LineSegment2D()

LineSegment2D ( const HepGeom::Point3D< double > &  point1,
const HepGeom::Point3D< double > &  point2 
)

Constructor.

Parameters
[in]point1First point.
[in]point2Second point.

Definition at line 14 of file LineSegment2D.cc.

15  :
16  Line2D(point1.x(), point1.y(),
17  point2.x() - point1.x(), point2.y() - point1.y())
18 {
19 }
Line2D(double x, double y, double vecx, double vecy)
Constructor.
Definition: Line2D.cc:17

Member Function Documentation

◆ findIntersection() [1/6]

int findIntersection ( const Arc2D arc,
HepGeom::Point3D< double >  intersections[2] 
) const

Find intersections with an arc.

Parameters
[in]arcArc.
[out]intersectionsIntersections.
Returns
Number of intersections (0, 1 or 2).

Definition at line 67 of file LineSegment2D.cc.

◆ findIntersection() [2/6]

int findIntersection ( const Circle2D circle,
HepGeom::Point3D< double >  intersections[2] 
) const

Find intersections with a circle.

Parameters
[in]circleCircle.
[out]intersectionsIntersections.
Returns
Number of intersections (0, 1 or 2).

Definition at line 54 of file LineSegment2D.cc.

◆ findIntersection() [3/6]

int findIntersection ( const Circle2D circle,
HepGeom::Point3D< double >  intersections[2],
double  t[2],
double  angles[2] 
) const
protectedinherited

Find intersections with a circle.

Parameters
[in]circleCircle.
[out]intersectionsIntersections.
[out]tValues of t for intersection points.
[out]anglesValues of angles for intersection points.
Returns
Number of intersections (0, 1 or 2).

Definition at line 95 of file Line2D.cc.

◆ findIntersection() [4/6]

int findIntersection ( const Line2D line,
HepGeom::Point3D< double > *  intersection 
) const

Find intersection with a line.

Parameters
[in]lineLine.
[out]intersectionIntersection.
Returns
Number of intersections (0 or 1).

Definition at line 25 of file LineSegment2D.cc.

◆ findIntersection() [5/6]

int findIntersection ( const Line2D line,
HepGeom::Point3D< double > *  intersection,
double  t[2] 
) const
inherited

Find intersection with a line.

Parameters
[in]lineLine.
[out]intersectionIntersection.
[out]tValues of t for intersection point (t[0] - this line, t[1] - line from argument).
Returns
Number of intersections (0 or 1).

If (*this) and line are the same line then 0 is returned.

Definition at line 65 of file Line2D.cc.

◆ findIntersection() [6/6]

int findIntersection ( const LineSegment2D lineSegment,
HepGeom::Point3D< double > *  intersection 
) const

Find intersection with a line segment.

Parameters
[in]lineSegmentLine segment.
[out]intersectionIntersection.
Returns
Number of intersections (0 or 1).

Definition at line 40 of file LineSegment2D.cc.

◆ selectIntersections()

int selectIntersections ( HepGeom::Point3D< double > *  intersections,
bool *  condition,
int  n 
) const
protectedinherited

Select intersections.

Parameters
[in,out]intersectionsIntersections.
[in]conditionSelection condition.
[in]nNumber of intersections.
Returns
Number of selected intersections.

Definition at line 132 of file Line2D.cc.

◆ tWithinRange()

bool tWithinRange ( double  t) const

Check if t is within the line segment (0 <= t <= 1).

Parameters
[in]tLine parameter.

Definition at line 80 of file LineSegment2D.cc.


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