Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OOPointMaths.h File Reference
import "OOFunctionAttributes.h"
#include <tgmath.h>
+ Include dependency graph for OOPointMaths.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

OOINLINE NSPoint PtAdd (NSPoint a, NSPoint b)
 
OOINLINE NSPoint PtSub (NSPoint a, NSPoint b)
 
OOINLINE NSPoint PtScale (NSPoint p, CGFloat scale)
 
OOINLINE CGFloat PtDot (NSPoint a, NSPoint b)
 
OOINLINE CGFloat PtCross (NSPoint a, NSPoint b)
 
OOINLINE NSPoint PtRotCW (NSPoint p)
 
OOINLINE NSPoint PtRotACW (NSPoint p)
 
OOINLINE NSPoint PtNormal (NSPoint p)
 

Function Documentation

◆ PtAdd()

OOINLINE NSPoint PtAdd ( NSPoint a,
NSPoint b )

Definition at line 6 of file OOPointMaths.h.

7{
8 return NSMakePoint(a.x + b.x, a.y + b.y);
9}

Referenced by BuildOutlineContour().

+ Here is the caller graph for this function:

◆ PtCross()

OOINLINE CGFloat PtCross ( NSPoint a,
NSPoint b )

Definition at line 26 of file OOPointMaths.h.

27{
28 return a.x * b.y - b.x * a.y;
29}

Referenced by BuildOutlineContour().

+ Here is the caller graph for this function:

◆ PtDot()

OOINLINE CGFloat PtDot ( NSPoint a,
NSPoint b )

Definition at line 21 of file OOPointMaths.h.

22{
23 return a.x * b.x + a.y * b.y;
24}

Referenced by BuildOutlineContour(), and PtNormal().

+ Here is the caller graph for this function:

◆ PtNormal()

OOINLINE NSPoint PtNormal ( NSPoint p)

Definition at line 43 of file OOPointMaths.h.

44{
45 return PtScale(p, 1.0 / sqrt(PtDot(p, p)));
46}
OOINLINE CGFloat PtDot(NSPoint a, NSPoint b)
OOINLINE NSPoint PtScale(NSPoint p, CGFloat scale)

References PtDot(), and PtScale().

Referenced by BuildOutlineContour().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PtRotACW()

OOINLINE NSPoint PtRotACW ( NSPoint p)

Definition at line 37 of file OOPointMaths.h.

38{
39 // Rotate 90 degrees anticlockwise.
40 return NSMakePoint(-p.y, p.x);
41}

Referenced by BuildOutlineContour().

+ Here is the caller graph for this function:

◆ PtRotCW()

OOINLINE NSPoint PtRotCW ( NSPoint p)

Definition at line 31 of file OOPointMaths.h.

32{
33 // Rotate 90 degrees clockwise.
34 return NSMakePoint(p.y, -p.x);
35}

◆ PtScale()

OOINLINE NSPoint PtScale ( NSPoint p,
CGFloat scale )

Definition at line 16 of file OOPointMaths.h.

17{
18 return NSMakePoint(p.x * scale, p.y * scale);
19}

Referenced by BuildOutlineContour(), and PtNormal().

+ Here is the caller graph for this function:

◆ PtSub()

OOINLINE NSPoint PtSub ( NSPoint a,
NSPoint b )

Definition at line 11 of file OOPointMaths.h.

12{
13 return NSMakePoint(a.x - b.x, a.y - b.y);
14}

Referenced by BuildOutlineContour().

+ Here is the caller graph for this function: