xc
Public Member Functions | Protected Member Functions | Friends | List of all members
Line2d Class Reference

Line in a two-dimensional space. More...

#include <Line2d.h>

Inheritance diagram for Line2d:
Inheritance graph
[legend]
Collaboration diagram for Line2d:
Collaboration graph
[legend]

Public Member Functions

 Line2d (void)
 Default constructor.
 
 Line2d (const CGLine_2 &r)
 Copy constructor.
 
 Line2d (const Pos2d &, const Pos2d &)
 Constructor. More...
 
 Line2d (const Pos2d &, const Dir2d &)
 Constructor. More...
 
 Line2d (const Pos2d &, const Vector2d &)
 Constructor. More...
 
 Line2d (const Line2dParametricForm &)
 Constructs the line from its parametric equation.
 
 Line2d (const GeomObj2d::list_Pos2d &)
 Constructs the line from the given point list (least squares method). More...
 
 Line2d (const boost::python::list &)
 Constructs the line from the given point list (least squares method). More...
 
virtual bool operator== (const Line2d &) const
 Comparison operator.
 
const CGLine_2 & ToCGAL (void) const
 
virtual GeomObjgetCopy (void) const
 Constructor virtual.
 
void swap (void)
 @ brief Swaps the line orientation.
 
void TwoPoints (const Pos2d &p1, const Pos2d &p2)
 
virtual GEOM_FT GetMax (unsigned short int) const
 Return the maximum value of the i-th coordinate.
 
virtual GEOM_FT GetMin (unsigned short int) const
 Return the minimum value of the i-th coordinate.
 
Pos2d Projection (const Pos2d &p) const
 Return orthogonal projection of p onto the line.
 
Vector2d Projection (const Vector2d &) const
 Return orthogonal projection of v onto the line.
 
GeomObj::list_Pos2d Project (const GeomObj::list_Pos2d &ptos) const
 Return the projections of the points onto the line.
 
GEOM_RT a (void) const
 Returns the a parameter of the line equation in general form: a*x + b*y + c= 0.
 
GEOM_RT b (void) const
 Returns the b parameter of the line equation in general form: a*x + b*y + c= 0.
 
GEOM_RT c (void) const
 Returns the c parameter of the line equation in general form: a*x + b*y + c= 0.
 
GEOM_FT getSlope (void) const
 Return the slope of the line.
 
GEOM_FT GetParamA (void) const
 Return the a parameter (y=a*x+b) of the horizontal projection of the line. More...
 
GEOM_FT GetParamB (void) const
 Return the b parameter (y=a*x+b) of the horizontal projection of the line. More...
 
GEOM_FT GetY (const GEOM_FT &x) const
 
GEOM_FT Parametro (const Pos2d &p) const
 Return the parameter of the point on the line. More...
 
GeomObj::list_Pos2d Ordena (const GeomObj::list_Pos2d &ptos) const
 Return the points ordered by the value of the parameter of its projection onto the line from lowest to highest. More...
 
Pos2d Point (const int &i=0) const
 Return an arbitrary point of the line. More...
 
double getLambda (unsigned short int i, const double &d, const Vector2d &i_) const
 
virtual GEOM_FT getLambda (const Pos2d &) const
 Return the length along the line until the given point is reached: p= Point(0)+lambda*VDir()
 
Line2dParametricForm GetParametricas (void) const
 Returns the line equation in parametric form a: v[0]: point in the line. More...
 
Pos2d PtoParametricas (const GEOM_FT &lambda) const
 Return a point of the line at a distance delta from its origin. More...
 
void Parametricas (const Line2dParametricForm &param)
 Line redefined from a parametric equation.
 
bool EsVertical (void) const
 Return true if the line is vertical.
 
bool isDegenerated (void) const
 Return true if the line is degenerated.
 
bool In (const Pos2d &p, const double &tol=0.0) const
 Return true if the point is on the line.
 
bool negativeSide (const Pos2d &p) const
 Return true if the point is on the right side of the line.
 
bool positiveSide (const Pos2d &p) const
 Return true if the point is on the left side of the line.
 
GEOM_FT dist2 (const Pos2d &p) const
 Return the squared distance from the point to the line.
 
virtual GEOM_FT dist (const Pos2d &p) const
 Return the squared distance from the point to the line.
 
Line2d Perpendicular (const Pos2d &p) const
 Return the line perpendicular to this one through p.
 
Line2d isParallel (const Pos2d &v) const
 Return a parallel line passing through p.
 
Line2d offset (const Vector2d &v) const
 Return the line that result from displacing this one by the vector argument. More...
 
Line2d offset (const GEOM_FT &d) const
 Return a line parallel to this one at the distance being passed as parameter. More...
 
void Put (const Pos2d &p1, const Pos2d &p2)
 Set the points that define the line.
 
bool intersects (const Line2d &r2) const
 Return true if the line intersects the argument one.
 
GeomObj2d::list_Pos2d getIntersection (const Line2d &r2) const
 Return the point intersection of both lines, if doesn't exists it returns an empty list. More...
 
bool intersects (const Ray2d &p) const
 Return verdadero if exists the intersection with the line argument.
 
Pos2d getIntersection (const Ray2d &p) const
 Return (if exists) the intersection with the ray argument.
 
bool intersects (const Segment2d &p) const
 Return true if the intersection with the segment argument exists. More...
 
Pos2d getIntersection (const Segment2d &p) const
 Return (if exists) the intersection with the segment argument.
 
GeomObj2d::list_Pos2d getIntersection (const Polyline2d &) const
 Return (if exists) the intersections with the poliline argument.
 
GeomObj2d::list_Pos2d getIntersection (unsigned short int i, const double &d) const
 Return the intersection of the line with the plane defined by the equation coord_i= d. More...
 
bool isParallel (const Line2d &r) const
 
virtual GEOM_FT getLength (void) const
 Return object length.
 
virtual Pos2d getCenterOfMass (void) const
 Return the center of mass of the line.
 
Dir2d GetDir (void) const
 
Vector2d VDir (void) const
 
Vector2d Normal (void) const
 Return the direction vector of the segment.
 
Vector2d VersorDir (void) const
 
virtual Vector2d getIVector (void) const
 Returns a vector in the direction of the local X axis. More...
 
virtual Vector2d getJVector (void) const
 Returns a vector in the direction of the local Y axis. More...
 
Line2d Bisectriz (const Line2d &r) const
 Return the bisection line of this one an the argument line. More...
 
Line2d getNormalized (void) const
 
double getAngle (const Vector2d &v) const
 Return the angle con el vector que se pasa como parámetro.
 
double Azimuth (void) const
 Return the angle con el Y axis.
 
GEOM_FT linearLeastSquaresFitting (const GeomObj2d::list_Pos2d &lp)
 Compute the line that best suits the point cloud.
 
GEOM_FT linearLeastSquaresFittingPy (const boost::python::list &lp)
 Compute the line that best suits the point cloud.
 
virtual GEOM_FT Ix (void) const
 Moment of inertia with respect to the center of mass en local axis.
 
virtual GEOM_FT Iy (void) const
 Moment of inertia with respect to the center of mass en local axis.
 
virtual GEOM_FT Pxy (void) const
 ! More...
 
virtual GEOM_FT Iz (void) const
 Moment of inertia polar with respect to the center of mass en local axis.
 
void Transform (const Trf2d &trf2d)
 Applies the transformation argument to the line.
 
boost::python::dict getPyDict (void) const
 Return a Python dictionary with the object members values.
 
void setPyDict (const boost::python::dict &)
 Set the values of the object members from a Python dictionary.
 
void Print (std::ostream &os) const
 
void Plot (Plotter &psos) const
 
- Public Member Functions inherited from Linear2d
virtual unsigned short int Dimension (void) const
 Return the dimension of the object 0, 1, 2 or 3.
 
virtual GEOM_FT getArea (void) const
 Return the area of the object.
 
virtual GEOM_FT getVolume (void) const
 Return the volume of the object.
 
std::vector< std::pair< Pos2d, GEOM_FT > > sortPointsAlong (const GeomObj2d::list_Pos2d &) const
 Return the given points sorted by its parameter along the line (assuming they are on the line) in the form of a list of (position, lambda) pairs. More...
 
boost::python::list sortPointsAlongPy (const boost::python::list &) const
 Return the given points sorted by its parameter along the line (assuming they are on the line) in the form of a list of (position, lambda) pairs. More...
 
- Public Member Functions inherited from GeomObj2d
GEOM_FT GetXMax (void) const
 
GEOM_FT GetYMax (void) const
 
GEOM_FT GetXMin (void) const
 
GEOM_FT GetYMin (void) const
 
Pos2d getPMax (void) const
 
Pos2d getPMin (void) const
 
BND2d Bnd (void) const
 Return the bounding rectangle.
 
virtual bool Out (const Pos2d &p, const double &tol=0.0) const
 Return true if the point lies outside the object.
 
virtual GEOM_FT getCenterOfMassFactor (void) const
 Return the factor used for the computation of the center of mass (1.0 by default). More...
 
double Theta_p (void) const
 Return the angle of one of the principal axis of inertia.
 
Dir2d IAxisDir_a (void) const
 Return the dirección de un principal axis of inertia (we don't know if it's the major or the minor yet). More...
 
Dir2d IAxisDir_b (void) const
 Return the direction of the other principal axis of inertia (we don't know if it's the major or the minor yet). More...
 
Line2d IAxis_a (void) const
 Return un principal axis of inertia (no sabemos si el mayor o el menor.
 
Line2d IAxis_b (void) const
 Return un principal axis of inertia (no sabemos si el mayor o el menor.
 
Ref2d2d PrincipalAxesOfInertia (void) const
 Return los principal axis of inertia.
 
GEOM_FT I1 (void) const
 Return the moment of inertia principal mayor.
 
GEOM_FT I2 (void) const
 Return the moment of inertia principal menor.
 
PrincipalAxesOfInertia2D Inertia (void)
 
GEOM_FT I (const unsigned short int &i, const unsigned short int &j) const
 Return the componente i,j of the inertia tensor computed with respect to the center of mass. More...
 
virtual GEOM_FT IArea (void) const
 
GEOM_FT I (const Pos2d &O, const Vector2d &e) const
 Return the moment of inertia with respect to the axis that passes through O with the direction of e. More...
 
GEOM_FT I (const Line2d &r) const
 Return the moment of inertia with respect to the line argument.
 
GEOM_FT I (const unsigned short int i, const unsigned short int j, const Pos2d &o) const
 Return the component i,j of the inertia tensor computed with respect to the point "o". More...
 
GEOM_FT IO (const Pos2d &o) const
 Return the polar moment of inertia with respect to the point o.
 
FT_matrix I (void) const
 Return the inertia tensor with respect to the center of mass of the object.
 
FT_matrix I (const Pos2d &o) const
 Return the inertia tensor with respect to the point o.
 
virtual void Move (const Vector2d &)
 Desplaza el objeto.
 
- Public Member Functions inherited from GeomObj
 GeomObj (void)
 Constructor.
 
virtual bool hasCenterOfMass (void) const
 Return true if the object has a center of mass.
 
GEOM_FT getCenterOfMassArea (void) const
 Return the dimension used to compute the center of mass, as follows: More...
 
- Public Member Functions inherited from ProtoGeom
 ProtoGeom (void)
 False when solution is not possible: intersection of parallel planes. More...
 
void setExists (bool e)
 
bool exists (void) const
 
boost::python::dict getPyDict (void) const
 Return a Python dictionary with the object members values.
 
void setPyDict (const boost::python::dict &)
 Set the values of the object members from a Python dictionary.
 
- Public Member Functions inherited from CommandEntity
 CommandEntity (CommandEntity *owr=nullptr)
 Default constructor.
 
CommandEntityOwner (void)
 Return a pointer to the object owner.
 
const CommandEntityOwner (void) const
 Return un puntero al objeto propietario de ESTE.
 
const StandardOutputWrappergetStandardOutputWrapper (void) const
 Return the regular output stream wrapper.
 
StandardOutputWrappergetStandardOutputWrapper (void)
 Return the regular output stream wrapper.
 
const std::string & getLogFileName (void) const
 Returns log file name.
 
void setLogFileName (const std::string &)
 Sets log file name.
 
const std::string & getErrFileName (void) const
 Returns err file name.
 
void setErrFileName (const std::string &)
 Sets error file name.
 
const std::string & getOutputFileName (void) const
 Returns regular output file name.
 
void setOutputFileName (const std::string &)
 Sets regular output file name.
 
boost::python::object evalPy (boost::python::object dict, const std::string &)
 Return the Python object that results from evaluating the argument.
 
boost::python::object execPy (boost::python::object dict, const std::string &)
 Return the Python objects that results from executing the code in the string argument.
 
boost::python::object execFilePy (boost::python::object dict, const std::string &)
 Return the Python object that results from executing the code in the file.
 
- Public Member Functions inherited from EntityWithProperties
 EntityWithProperties (EntityWithProperties *owr=nullptr)
 Default constructor.
 
void clearPyProps (void)
 Clear python properties map.
 
bool hasPyProp (const std::string &)
 Returns true if property exists.
 
boost::python::object getPyProp (const std::string &str)
 Return the Python object with the name being passed as parameter.
 
void setPyProp (std::string str, boost::python::object val)
 Sets/appends a value tho the Python object's dictionary.
 
void copyPropsFrom (const EntityWithProperties &)
 Copy the properties from the argument.
 
boost::python::list getPropNames (void) const
 Return the names of the object properties weightings.
 
const PythonDict & getPropertiesDict (void) const
 Return a std::map container with the properties of the object.
 
boost::python::dict getPyDict (void) const
 Return a Python dictionary containing the object members values.
 
void setPyDict (const boost::python::dict &)
 Set the values of the object members from a Python dictionary.
 
- Public Member Functions inherited from EntityWithOwner
 EntityWithOwner (EntityWithOwner *owr=nullptr)
 Default constructor.
 
 EntityWithOwner (const EntityWithOwner &)
 Copy constructor.
 

◆ regularize()

void Line2d::regularize ( void  )
protected

If the line origin has very large coordinates (>1e6) replace it with the intersection of the line with one of the coordinate planes.

Otherwise the behaviour of the line gets dominated by the large values of those coordinates which results in an erratic one.


The documentation for this class was generated from the following files:
  • src/utility/geom/d1/Line2d.h
  • src/utility/geom/d1/Line2d.cc