pcod-common v1.0.0
Shared preprocessing and postprocessing for point-cloud object detection
Loading...
Searching...
No Matches
pcod_common::Line Struct Reference

#include <bounding_box.hpp>

Public Member Functions

 Line (const BoundingBoxVertex &v1, const BoundingBoxVertex &v2)
 
float operator() (const BoundingBoxVertex &p) const
 
BoundingBoxVertex intersection (const Line &other) const
 

Public Attributes

float a
 X coefficient.
 
float b
 Y coefficient.
 
float c
 Constant term.
 

Detailed Description

Implicit two-dimensional line equation a*x + b*y + c = 0.

Definition at line 37 of file bounding_box.hpp.

Constructor & Destructor Documentation

◆ Line()

pcod_common::Line::Line ( const BoundingBoxVertex & v1,
const BoundingBoxVertex & v2 )
inline

Construct the line passing through two vertices.

Parameters
v1First vertex.
v2Second vertex.

Definition at line 46 of file bounding_box.hpp.

46 {
47 a = v2.y - v1.y;
48 b = v1.x - v2.x;
49 c = v2.cross(v1);
50 }
float a
X coefficient.
float b
Y coefficient.
float c
Constant term.

References a, b, c, pcod_common::BoundingBoxVertex::cross(), pcod_common::BoundingBoxVertex::x, and pcod_common::BoundingBoxVertex::y.

Member Function Documentation

◆ intersection()

BoundingBoxVertex pcod_common::Line::intersection ( const Line & other) const
inline
Parameters
otherNon-parallel line.
Returns
Intersection vertex.

Definition at line 56 of file bounding_box.hpp.

56 {
57 float w = a * other.b - b * other.a;
58 return BoundingBoxVertex((b * other.c - c * other.b) / w, (c * other.a - a * other.c) / w);
59 }

References a, b, and c.

Referenced by pcod_common::BoundingBox::intersection_area().

◆ operator()()

float pcod_common::Line::operator() ( const BoundingBoxVertex & p) const
inline
Parameters
pEvaluation point.
Returns
Value of the line equation.

Definition at line 53 of file bounding_box.hpp.

53{ return a * p.x + b * p.y + c; }

References a, b, c, pcod_common::BoundingBoxVertex::x, and pcod_common::BoundingBoxVertex::y.

Member Data Documentation

◆ a

float pcod_common::Line::a

X coefficient.

Definition at line 38 of file bounding_box.hpp.

Referenced by intersection(), Line(), and operator()().

◆ b

float pcod_common::Line::b

Y coefficient.

Definition at line 39 of file bounding_box.hpp.

Referenced by intersection(), Line(), and operator()().

◆ c

float pcod_common::Line::c

Constant term.

Definition at line 40 of file bounding_box.hpp.

Referenced by intersection(), Line(), and operator()().


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