MCPcopy Create free account
hub / github.com/melonjs/melonJS / quadNormal

Function quadNormal

packages/melonjs/tests/sprite3d.spec.js:78–90  ·  view source on GitHub ↗
(v)

Source from the content-addressed store, hash-verified

76
77 // normal of the projected quad (corners 0,1,3) — should face the camera
78 const quadNormal = (v) => {
79 const e1 = new Vector3d(
80 v[3] - v[0],
81 v[4] - v[1],
82 v[5] - v[2], // corner1 - corner0
83 );
84 const e2 = new Vector3d(
85 v[9] - v[0],
86 v[10] - v[1],
87 v[11] - v[2], // corner3 - corner0
88 );
89 return e1.cross(e2).normalize();
90 };
91
92 it("spherical: the quad normal is parallel to the camera forward axis", () => {
93 const cam = new Camera3d(0, 0, 64, 64);

Callers 1

sprite3d.spec.jsFile · 0.85

Calls 2

crossMethod · 0.95
normalizeMethod · 0.45

Tested by

no test coverage detected