Aleph-w  1.9
General library for algorithms and data structures
Segment Class Reference

#include <point.H>

Inherits Geom_Object.

Public Types

enum  Sense {
  E, NE, N, NW,
  W, S, SW, SE
}
 

Public Member Functions

bool operator== (const Segment &s) const
 
bool operator!= (const Segment &s) const
 
const Pointhighest_point () const
 
const Pointlowest_point () const
 
const Pointleftmost_point () const
 
const Pointrightmost_point () const
 
const Pointget_src_point () const
 
const Pointget_tgt_point () const
 
 Segment (const Segment &s)
 
 Segment (const Point &__src, const Point &__tgt)
 
 Segment (const Point &__src, const Geom_Number &m, const Geom_Number &l)
 
 Segment (const Segment &sg, const Geom_Number &dist)
 Builds a new segment parallel to sg and with a distance dist.
 
double slope () const
 
double counterclockwise_angle_with (const Segment &s) const
 Compute the counterclock wise angle respect another segment s.
 
double counterclockwise_angle () const
 Compute the counterclock angle of this respect x-axis.
 
Geom_Number size () const
 
bool is_colinear_with (const Point &p) const
 
bool is_to_left_from (const Point &p) const
 
bool is_to_right_from (const Point &p) const
 
Point mid_point () const
 
const Pointnearest_point (const Point &p) const
 
Segment get_perpendicular (const Point &p) const
 
Segment mid_perpendicular (const Geom_Number &dist) const
 
bool intersects_properly_with (const Segment &s) const
 
bool contains_to (const Point &p) const
 
bool contains_to (const Segment &s) const
 
bool intersects_with (const Segment &s) const
 
bool intersects_with (const Triangle &t) const
 
bool intersects_with (const Ellipse &e) const
 
bool is_parallel_with (const Segment &s) const
 
Point intersection_with (const Segment &s) const
 
Sense sense () const
 
void enlarge_src (const Geom_Number &__dist)
 
void enlarge_tgt (const Geom_Number &__dist)
 
std::string to_string () const
 
 operator std::string () const
 
void rotate (const double &angle)
 
Segment intersection_with (const Triangle &t) const
 
Segment intersection_with (const Ellipse &e) const
 
 Segment (const Point *__a, const Point *__b)
 
 Segment (const Point &__a, const Point &__b)
 
const bool operator== (const Segment &segment) const
 
const bool intersect (const Segment &segment) const
 
const Pointget_a ()
 
const Pointget_b ()
 
Point horiz_line_inter (const Geom_Number &__y)
 
const Pointhighest_point ()
 
const Pointlowest_point ()
 

Friends

class Point
 
class Triangle
 

Detailed Description

Fundamental segment defined by two points.

Constructor & Destructor Documentation

◆ Segment()

Segment::Segment ( const Point __src,
const Geom_Number &  m,
const Geom_Number &  l 
)
inline

Builds a new segment given source point, slope and length.

It computes the source point by usen these equations:

  1. $ d^2 = (x - x1)^2 + (y - y1)^2$ (Pitágoras)
  2. $ y - y1 = m*(x - x1)$ (ecuación de recta dada punto y pendiente)
Parameters
[in]__srcSource point
[in]mslope (in radians)
[in]llength

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

Leandro Rabindranath León