libtonc
Point functions

Data Structures

struct  POINT
 2D Point struct More...
 

Typedefs

typedef struct POINT POINT
 2D Point struct
 
typedef struct POINT POINT32
 

Functions

INLINE POINTpt_set (POINT *pd, int x, int y)
 Initialize pd to (x, y)
 
INLINE POINTpt_add (POINT *pd, const POINT *pa, const POINT *pb)
 Point addition: pd = pa + pb.
 
INLINE POINTpt_sub (POINT *pd, const POINT *pa, const POINT *pb)
 Point subtraction: pd = pa - pb.
 
INLINE POINTpt_scale (POINT *pd, const POINT *pa, int c)
 Point scale: pd = c * pa.
 
INLINE POINTpt_add_eq (POINT *pd, const POINT *pb)
 Point increment: pd += pb.
 
INLINE POINTpt_sub_eq (POINT *pd, const POINT *pb)
 Point decrement: pd -= pb.
 
INLINE POINTpt_scale_eq (POINT *pd, int c)
 Point scale: pd *= c.
 
INLINE int pt_cross (const POINT *pa, const POINT *pb)
 Point 'cross'-product: pa × pb.
 
INLINE int pt_dot (const POINT *pa, const POINT *pb)
 Point 'dot'-product:pa · pb.
 
int pt_in_rect (const POINT *pt, const struct RECT *rc)
 

Detailed Description

Function Documentation

◆ pt_cross()

INLINE int pt_cross ( const POINT pa,
const POINT pb 
)

Point 'cross'-product: pa × pb.

Actually, there's no such thing as a 2D cross-product, but you could extend it to 3D and get the value of its z-component, which can be used for a test for parallelism.