public function Distance(ALiVE_Vector $point) { // calculate the distance of $point from plane return abs($this->mNormal->X() * $point->X() + $this->mNormal->Y() * $point->Y() + $this->mNormal->Z() * $point->Z() + $this->D()); // normally we would also need to divide this number by $this->mNormal->Length(), // but since we assert normal is a unit vector, this is unnecessary }
function ALiVE_Vectors_Equal(ALiVE_Vector $a, ALiVE_Vector $b) { return $a->X() == $b->X() && $a->Y() == $b->Y() && $a->Z() == $b->Z(); }