LCOV - code coverage report
Current view: top level - src - Plane.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 35 35
Test Date: 2026-04-03 02:26:39 Functions: 100.0 % 10 10

            Line data    Source code
       1              : #include "Plane.h"
       2              : 
       3              : //------------------------------------------------------------------------------
       4          374 : Plane::Plane() {
       5          187 :   a_ = 1.0f;
       6          187 :   b_ = 0.0f;
       7          187 :   c_ = 0.0f;
       8          187 :   d_ = 0.0f;
       9          374 : }
      10              : 
      11              : //------------------------------------------------------------------------------
      12          374 : Plane::~Plane() {}
      13              : 
      14              : //------------------------------------------------------------------------------
      15           60 : void Plane::setPlane(const float &a, const float &b, const float &c, const float &d) {
      16           60 :   a_ = a; b_ = b; c_ = c; d_ = d;
      17           60 : }
      18              : 
      19              : //------------------------------------------------------------------------------
      20           59 : void Plane::normalize() {
      21           59 :   float len = sqrt((a_ * a_) + (b_ * b_) + (c_ * c_));
      22              : 
      23           59 :   if (len != 0.0f) {
      24           58 :     a_ = (a_ / len);
      25           58 :     b_ = (b_ / len);
      26           58 :     c_ = (c_ / len);
      27           58 :     d_ = (d_ / len);
      28           58 :   }
      29           59 : }
      30              : 
      31              : //------------------------------------------------------------------------------
      32           29 : float Plane::distanceToPoint(const float &x, const float &y, const float &z) {
      33           29 :   return ((a_ * x) + (b_ * y) + (c_ * z) + d_);
      34              : }
      35              : 
      36              : //------------------------------------------------------------------------------
      37            3 : int Plane::classifyPoint(const float &x, const float &y, const float &z) {
      38            3 :   float len = (a_ * x) + (b_ * y) + (c_ * z) + d_;
      39              : 
      40            3 :   if (len < 0)
      41            1 :     return (-1);
      42            2 :   else if (len > 0)
      43            1 :     return (1);
      44              :   else
      45            1 :     return (0);
      46            3 : }
      47              : 
      48              : //------------------------------------------------------------------------------
      49            1 : void Plane::getNormalVector(Vector &v) const {
      50            1 :   v.setVector(a_, b_, c_);
      51            1 : }
      52              : 
      53              : //------------------------------------------------------------------------------
      54           13 : void Plane::getDefinition(float &a, float &b, float &c, float &d) const {
      55           13 :   a = a_; b = b_; c = c_; d = d_;
      56           13 : }
        

Generated by: LCOV version 2.4-0