LCOV - code coverage report
Current view: top level - Core - OOPointMaths.h (source / functions) Hit Total Coverage
Test: coverxygen.info Lines: 0 9 0.0 %
Date: 2025-05-28 07:50:54 Functions: 0 0 -

          Line data    Source code
       1           0 : #import "OOFunctionAttributes.h"
       2             : #include <tgmath.h>
       3             : 
       4             : 
       5             : // Utilities for working with NSPoints as 2D vectors.
       6           0 : OOINLINE NSPoint PtAdd(NSPoint a, NSPoint b)
       7             : {
       8             :         return NSMakePoint(a.x + b.x, a.y + b.y);
       9             : }
      10             : 
      11           0 : OOINLINE NSPoint PtSub(NSPoint a, NSPoint b)
      12             : {
      13             :         return NSMakePoint(a.x - b.x, a.y - b.y);
      14             : }
      15             : 
      16           0 : OOINLINE NSPoint PtScale(NSPoint p, CGFloat scale)
      17             : {
      18             :         return NSMakePoint(p.x * scale, p.y * scale);
      19             : }
      20             : 
      21           0 : OOINLINE CGFloat PtDot(NSPoint a, NSPoint b)
      22             : {
      23             :         return a.x * b.x + a.y * b.y;
      24             : }
      25             : 
      26           0 : OOINLINE CGFloat PtCross(NSPoint a, NSPoint b)
      27             : {
      28             :         return a.x * b.y - b.x * a.y;
      29             : }
      30             : 
      31           0 : OOINLINE NSPoint PtRotCW(NSPoint p)
      32             : {
      33             :         // Rotate 90 degrees clockwise.
      34             :         return NSMakePoint(p.y, -p.x);
      35             : }
      36             : 
      37           0 : OOINLINE NSPoint PtRotACW(NSPoint p)
      38             : {
      39             :         // Rotate 90 degrees anticlockwise.
      40             :         return NSMakePoint(-p.y, p.x);
      41             : }
      42             : 
      43           0 : OOINLINE NSPoint PtNormal(NSPoint p)
      44             : {
      45             :         return PtScale(p, 1.0 / sqrt(PtDot(p, p)));
      46             : }

Generated by: LCOV version 1.14