Commit 2208d28c authored by COULAUD Olivier's avatar COULAUD Olivier
Browse files

Add norm2 function

parent f925edbb
// =================================================================================== // ===================================================================================
// Logiciel initial: ScalFmm Version 0.5 // Logiciel initial: ScalFmm Version 0.5
// Co-auteurs : Olivier Coulaud, Bérenger Bramas. // Co-auteurs : Olivier Coulaud, B��renger Bramas.
// Propriétaires : INRIA. // Propri��taires : INRIA.
// Copyright © 2011-2012, diffusé sous les termes et conditions dune licence propriétaire. // Copyright �� 2011-2012, diffus�� sous les termes et conditions d���une licence propri��taire.
// Initial software: ScalFmm Version 0.5 // Initial software: ScalFmm Version 0.5
// Co-authors: Olivier Coulaud, Bérenger Bramas. // Co-authors: Olivier Coulaud, B��renger Bramas.
// Owners: INRIA. // Owners: INRIA.
// Copyright © 2011-2012, spread under the terms and conditions of a proprietardata[1] license. // Copyright �� 2011-2012, spread under the terms and conditions of a proprietardata[1] license.
// =================================================================================== // ===================================================================================
#ifndef FPOINT_HPP #ifndef FPOINT_HPP
#define FPOINT_HPP #define FPOINT_HPP
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
} }
/** /**
* Assignement operator * Assignment operator
* @param other the source class to copy * @param other the source class to copy
*/ */
FPoint(const FPoint& other, const FReal addset) { FPoint(const FPoint& other, const FReal addset) {
...@@ -172,14 +172,23 @@ public: ...@@ -172,14 +172,23 @@ public:
FReal * getDataValue(){ FReal * getDataValue(){
return this->data ; return this->data ;
} }
/** /**
*Compute the distance to the origin *Compute the distance to the origin
* @return the norm of the Fpoint * @return the norm of the Fpoint
*/ */
FReal norm() const { FReal norm() const {
return FMath::Sqrt(this->data[0]*this->data[0]+this->data[1]*this->data[1] return FMath::Sqrt(this->data[0]*this->data[0]+this->data[1]*this->data[1]
+this->data[2]*this->data[2]) ; +this->data[2]*this->data[2]) ;
} }
/**
*Compute the distance to the origin
* @return the square norm of the Fpoint
*/
FReal norm2() const {
return (this->data[0]*this->data[0]+this->data[1]*this->data[1]
+this->data[2]*this->data[2]) ;
}
/** /**
* Subtract to all dim the inValue * Subtract to all dim the inValue
...@@ -195,7 +204,7 @@ public: ...@@ -195,7 +204,7 @@ public:
/** /**
* Affect to all dim the inValue * Affect to all dim the inValue
* @param inValue the value to afect * @param inValue the value to affect
* @return the current object after being affected * @return the current object after being affected
*/ */
FPoint& operator+=(const FReal inValue){ FPoint& operator+=(const FReal inValue){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment