-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve (src): reformat implementation of
Firefly::Vector
member fu…
…nctions
- Loading branch information
Showing
12 changed files
with
57 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
#include "firefly/vector.hpp" | ||
|
||
namespace Firefly { | ||
Real Vector::ParallelogramArea(Vector const &_fvec) const { return this->Cross(_fvec)->Magnitude(); } | ||
Real Vector::ParallelogramArea(Vector const &_fvec) const { | ||
return this->Cross(_fvec)->Magnitude(); | ||
} | ||
|
||
Real Vector::TriangleArea(Vector const &_fvec) const { return this->ParallelogramArea(_fvec) / 2; } | ||
Real Vector::TriangleArea(Vector const &_fvec) const { | ||
return this->ParallelogramArea(_fvec) / 2; | ||
} | ||
} // namespace Firefly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
#include <cmath> | ||
|
||
#include "firefly/vector.hpp" | ||
|
||
namespace Firefly { | ||
bool Vector::IsParallel(const Vector &_fvec) { | ||
if (this->Magnitude() == 0 || _fvec.Magnitude() == 0) { | ||
return true; | ||
} | ||
return this->AngleWith(_fvec) == 0; | ||
|
||
auto angle_radians = this->AngleWith(_fvec); | ||
return angle_radians == 0 || angle_radians == M_PI; | ||
} | ||
} // namespace Firefly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#include "firefly/vector.hpp" | ||
|
||
namespace Firefly { | ||
std::unique_ptr<Vector> Vector::Normalize() const { return this->Scale(1 / this->Magnitude()); } | ||
std::unique_ptr<Vector> Vector::Normalize() const { | ||
return this->Scale(1 / this->Magnitude()); | ||
} | ||
} // namespace Firefly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters