clan::LineMath Class Reference - ClanLib SDK
Description: clan::LineMath Class Reference

Static Public Member Functions | List of all members
clan::LineMath Class Reference
clanCore Math

Math operations on 2D lines. More...

`#include <line_math.h>`

## Static Public Member Functions
static Pointf | closest_point (const Pointf &P, const Pointf &A, const Pointf &B)
| Return the Point on the line from A to B closest to point P.
static float | closest_point_relative (const Pointf &P, const Pointf &A, const Pointf &B)
| Return the relative position (0-1) of the point R on the line from A to B closest to point P.
static Pointf | midpoint (const Pointf &A, const Pointf &B)
| Return the midpoint of the line from point A to point B.
static float | point_right_of_line (const Pointf &A, const Pointf &B, const Pointf &P)
| Point right of line.
static float | point_right_of_line (float x, float y, float *line)
| Return [<0, 0, >0] if the Point P is right, on or left of the line trough A,B.
static float | point_right_of_line (float x, float y, float line_x1, float line_y1, float line_x2, float line_y2)
| Point right of line.

## Detailed Description

Math operations on 2D lines.

Obsolete - Use Line, LineRay, LineSegment

## Member Function Documentation

## ◆ closest_point()

Pointf clan::LineMath::closest_point | ( | const Pointf & | P,
|  | const Pointf & | A,
|  | const Pointf & | B )
| static

Return the Point on the line from A to B closest to point P.

Parameters

  P | point P
  A | point A
  B | point B

## ◆ closest_point_relative()

float clan::LineMath::closest_point_relative | ( | const Pointf & | P,
|  | const Pointf & | A,
|  | const Pointf & | B )
| static

Return the relative position (0-1) of the point R on the line from A to B closest to point P.

Parameters

  P | point P
  A | point A
  B | point B

## ◆ midpoint()

Pointf clan::LineMath::midpoint | ( | const Pointf & | A,
|  | const Pointf & | B )
| static

Return the midpoint of the line from point A to point B.

Also See LineSegment

Parameters

  A | = point A
  B | = point B

Returns
  The point

## ◆ point_right_of_line() [1/3]

float clan::LineMath::point_right_of_line | ( | const Pointf & | A,
|  | const Pointf & | B,
|  | const Pointf & | P )
| static

Point right of line.

Parameters

  A | = Pointf
  B | = Pointf
  P | = Pointf

Returns
  float

## ◆ point_right_of_line() [2/3]

float clan::LineMath::point_right_of_line | ( | float | x,
|  | float | y,
|  | float * | line )
| static

Return [<0, 0, >0] if the Point P is right, on or left of the line trough A,B.

Also See Line and LineSegment

Parameters

  x | = x coordinate of the point being tested.
  y | = y coordinate of the point being tested.
  line | = The line. A pointer to a float array with the elements {x1,y1,x2,y2}.

## ◆ point_right_of_line() [3/3]

float clan::LineMath::point_right_of_line | ( | float | x,
|  | float | y,
|  | float | line_x1,
|  | float | line_y1,
|  | float | line_x2,
|  | float | line_y2 )
| static

Point right of line.

Parameters

  x | = value
  y | = value
  line_x1 | = value
  line_y1 | = value
  line_x2 | = value
  line_y2 | = value

Returns
  float

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

- line_math.h