45#include "math/Triangle.hpp"
50 normal_(V3Zero), centroid_(V3Zero), area_(0.0), mass_(0.0),
51 facetVelocity_(V3Zero), a_(V3Zero), b_(V3Zero), c_(V3Zero),
52 HaveArea_(false), HaveNormal_(false), HaveUnitNormal_(false),
53 HaveCentroid_(false) {}
56 mass_(0.0), facetVelocity_(V3Zero), HaveArea_(false), HaveNormal_(false),
57 HaveUnitNormal_(false), HaveCentroid_(false) {
82RealType Triangle::computeArea() {
84 area_ = getNormal().
length() * 0.5;
90 normal_ =
cross(a_, b_);
94Vector3d Triangle::computeUnitNormal() {
95 HaveUnitNormal_ =
true;
96 unitnormal_ =
cross(a_, b_);
101Vector3d Triangle::computeCentroid() {
102 HaveCentroid_ =
true;
103 centroid_ = (vertices_[0] + vertices_[1] + vertices_[2]) / RealType(3.0);
107Mat3x3d Triangle::computeHydrodynamicTensor(RealType viscosity) {
109 Vector3d v0 = centroid_ - vertices_[0];
113 Vector3d v1 = centroid_ - vertices_[1];
117 Vector3d v2 = centroid_ - vertices_[2];
121 H = hydro_tensor(centroid_, centroid_, vertices_[1], vertices_[0], s0,
123 hydro_tensor(centroid_, centroid_, vertices_[1], vertices_[2], s1,
125 hydro_tensor(centroid_, centroid_, vertices_[2], vertices_[0], s2,
132 RealType s, RealType viscosity) {
133 Vector3d v2 = (rj0 + rj1 + rj2) / RealType(3.0);
141 G *= 1.0 / (8.0 * 3.14159285358979 * viscosity);
SquareMatrix3< Real > inverse() const
Sets the value of this matrix to the inverse of itself.
static SquareMatrix< Real, Dim > identity()
Real length()
Returns the length of this vector.
void normalize()
Normalizes this vector in place.
Real lengthSquare()
Returns the squared length of this vector.
This basic Periodic Table class was originally taken from the data.cpp file in OpenBabel.
Vector3< Real > cross(const Vector3< Real > &v1, const Vector3< Real > &v2)
Returns the cross product of two Vectors.