MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / getNewellVector

Function getNewellVector

src/utilities/geometry/Geometry.cpp:42–55  ·  view source on GitHub ↗

compute Newell vector from Point3dVector, direction is same as outward normal magnitude is twice the area

Source from the content-addressed store, hash-verified

40// compute Newell vector from Point3dVector, direction is same as outward normal
41// magnitude is twice the area
42OptionalVector3d getNewellVector(const Point3dVector& points) {
43 OptionalVector3d result;
44 const size_t N = points.size();
45 if (N >= 3) {
46 Vector3d vec;
47 for (unsigned i = 1; i < N - 1; ++i) {
48 const Vector3d v1 = points[i] - points[0];
49 const Vector3d v2 = points[i + 1] - points[0];
50 vec += v1.cross(v2);
51 }
52 result = vec;
53 }
54 return result;
55}
56
57// compute outward normal from Point3dVector
58OptionalVector3d getOutwardNormal(const Point3dVector& points) {

Callers 5

calcPolyhedronVolumeMethod · 0.85
newellVectorMethod · 0.85
getAreaFunction · 0.85
getOutwardNormalFunction · 0.85
TEST_FFunction · 0.85

Calls 2

crossMethod · 0.80
sizeMethod · 0.45

Tested by 1

TEST_FFunction · 0.68