Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Triangle Class Reference

#include <point.H>

Inheritance diagram for Triangle:
[legend]
Collaboration diagram for Triangle:
[legend]

Public Member Functions

 Triangle (const Point &__p1, const Point &__p2, const Point &__p3)
 
 Triangle (Point p, const Segment &s)
 
 Triangle (const Segment &s, const Point &p)
 
Geom_Number area () const
 
bool is_clockwise () const
 Returns true if the triangle vertices are ordered clockwise.
 
const Pointhighest_point () const
 
const Pointlowest_point () const
 
const Pointleftmost_point () const
 
const Pointrightmost_point () const
 
const Pointget_p1 () const
 
const Pointget_p2 () const
 
const Pointget_p3 () const
 
bool contains_to (const Point &p) const
 Returns true if point p lies inside this triangle.
 
Segment intersection_with (const Segment &s) const
 Returns the intersection segment between this triangle and segment s.
 
- Public Member Functions inherited from Geom_Object
 Geom_Object ()=default
 
virtual ~Geom_Object ()=default
 

Private Attributes

Point p1
 
Point p2
 
Point p3
 
Geom_Number __area
 

Friends

class Point
 
class Segment
 

Detailed Description

Definition at line 894 of file point.H.

Constructor & Destructor Documentation

◆ Triangle() [1/3]

Triangle::Triangle ( const Point __p1,
const Point __p2,
const Point __p3 
)
inline

Definition at line 904 of file point.H.

References __area, ah_domain_error_if, area_of_parallelogram(), p1, p2, and p3.

◆ Triangle() [2/3]

Triangle::Triangle ( Point  p,
const Segment s 
)
inline

Definition at line 913 of file point.H.

References __area, ah_domain_error_if, area_of_parallelogram(), p1, p2, and p3.

◆ Triangle() [3/3]

Triangle::Triangle ( const Segment s,
const Point p 
)
inline

Definition at line 922 of file point.H.

References __area, ah_domain_error_if, area_of_parallelogram(), p1, p2, and p3.

Member Function Documentation

◆ area()

Geom_Number Triangle::area ( ) const
inline

Definition at line 931 of file point.H.

References __area, and abs().

◆ contains_to()

bool Triangle::contains_to ( const Point p) const
inline

Returns true if point p lies inside this triangle.

Definition at line 977 of file point.H.

References Point::is_to_left_from(), p1, p2, and p3.

Referenced by demo_geometric_primitives(), and Segment::intersection_with().

◆ get_p1()

const Point & Triangle::get_p1 ( ) const
inline

◆ get_p2()

const Point & Triangle::get_p2 ( ) const
inline

◆ get_p3()

const Point & Triangle::get_p3 ( ) const
inline

◆ highest_point()

const Point & Triangle::highest_point ( ) const
inline

Definition at line 942 of file point.H.

References max(), p1, p2, p3, and Point::y.

◆ intersection_with()

Segment Triangle::intersection_with ( const Segment s) const
inline

Returns the intersection segment between this triangle and segment s.

Definition at line 991 of file point.H.

References Segment::intersection_with().

◆ is_clockwise()

bool Triangle::is_clockwise ( ) const
inline

Returns true if the triangle vertices are ordered clockwise.

Definition at line 937 of file point.H.

References __area.

◆ leftmost_point()

const Point & Triangle::leftmost_point ( ) const
inline

Definition at line 956 of file point.H.

References min(), p1, p2, p3, and Point::x.

◆ lowest_point()

const Point & Triangle::lowest_point ( ) const
inline

Definition at line 949 of file point.H.

References min(), p1, p2, p3, and Point::y.

◆ rightmost_point()

const Point & Triangle::rightmost_point ( ) const
inline

Definition at line 963 of file point.H.

References max(), p1, p2, p3, and Point::x.

Friends And Related Symbol Documentation

◆ Point

friend class Point
friend

Definition at line 896 of file point.H.

◆ Segment

friend class Segment
friend

Definition at line 897 of file point.H.

Member Data Documentation

◆ __area

Geom_Number Triangle::__area
private

Definition at line 901 of file point.H.

Referenced by Triangle(), Triangle(), Triangle(), area(), and is_clockwise().

◆ p1

Point Triangle::p1
private

◆ p2

Point Triangle::p2
private

◆ p3

Point Triangle::p3
private

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