MCPcopy Create free account
hub / github.com/CesiumGS/cesium-native / computeEdgeNormals

Function computeEdgeNormals

CesiumGeospatial/src/S2CellBoundingVolume.cpp:208–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208std::array<glm::dvec3, 4> computeEdgeNormals(
209 const Plane& plane,
210 const std::array<glm::dvec3, 4>& vertices,
211 bool invert) {
212 std::array<glm::dvec3, 4> result = {
213 glm::normalize(glm::cross(plane.getNormal(), vertices[1] - vertices[0])),
214 glm::normalize(glm::cross(plane.getNormal(), vertices[2] - vertices[1])),
215 glm::normalize(glm::cross(plane.getNormal(), vertices[3] - vertices[2])),
216 glm::normalize(glm::cross(plane.getNormal(), vertices[0] - vertices[3]))};
217
218 if (invert) {
219 result[0] = -result[0];
220 result[1] = -result[1];
221 result[2] = -result[2];
222 result[3] = -result[3];
223 }
224
225 return result;
226}
227
228/**
229 * Finds point on a line segment closest to a given point.

Callers 1

Calls 1

normalizeFunction · 0.85

Tested by

no test coverage detected