71 void setUnitNormal(
Vector3d normal) {
73 HaveUnitNormal_ =
true;
78 void addVertexSD(
StuntDouble* thisSD) { vertexSD_.push_back(thisSD); }
80 std::vector<StuntDouble*> getVertices() {
return vertexSD_; }
82 void setArea(RealType area) {
91 return computeNormal();
95 if (HaveUnitNormal_) {
98 return computeUnitNormal();
103 std::swap(vertices_[1], vertices_[2]);
106 a_ = vertices_[0] - vertices_[1];
107 b_ = vertices_[0] - vertices_[2];
108 c_ = vertices_[1] - vertices_[2];
110 HaveUnitNormal_ =
false;
118 return computeArea();
122 RealType computeArea();
127 void setCentroid(
Vector3d centroid) {
128 centroid_ = centroid;
129 HaveCentroid_ =
true;
136 return computeCentroid();
140 Vector3d getFacetVelocity() {
return facetVelocity_; }
142 void setFacetVelocity(
Vector3d facetVelocity) {
143 facetVelocity_ = facetVelocity;
146 void setFacetMass(RealType mass) { mass_ = mass; }
148 RealType getFacetMass() {
return mass_; }
150 Vector3d vertex1()
const {
return vertices_[0]; }
151 Vector3d vertex2()
const {
return vertices_[1]; }
152 Vector3d vertex3()
const {
return vertices_[2]; }
154 RealType a() {
return a_.
length(); }
156 RealType b() {
return b_.
length(); }
158 RealType c() {
return c_.
length(); }
160 RealType getHydroLength() {
164 RealType t1 = a1 + b1 + c1;
165 RealType t4 = a1 + b1 - c1;
167 return 32.0 * c1 / log(t1 * t1 / t4 / t4);
170 RealType getIncircleRadius() {
return 2.0 * getArea() / (a() + b() + c()); }
172 RealType getCircumcircleRadius() {
176 RealType t1 = a1 + b1 + c1;
177 RealType t2 = -a1 + b1 + c1;
178 RealType t3 = a1 - b1 + c1;
179 RealType t4 = a1 + b1 - c1;
180 return a1 * b1 * c1 / sqrt(t1 * t2 * t3 * t4);
183 Mat3x3d computeHydrodynamicTensor(RealType viscosity);
186 RealType area = getArea();
193 RealType v = 0.5 *
cross(v0, v2).length() / area;
194 RealType w = 0.5 *
cross(v0, v1).length() / area;
200 return barycentric.
x() * vertices_[0] + barycentric.
y() * vertices_[1] +
201 barycentric.
z() * vertices_[2];
210 std::vector<StuntDouble*> vertexSD_;
222 bool HaveUnitNormal_;