MCPcopy
hub / github.com/g3n/engine / ApplyMatrix

Method ApplyMatrix

geometry/geometry.go:466–481  ·  view source on GitHub ↗

TODO: https://stackoverflow.com/questions/21640545/how-to-check-for-convexity-of-a-3d-mesh func (g *Geometry) IsConvex() bool { { ApplyMatrix multiplies each of the geometry position vertices by the specified matrix and apply the correspondent normal transform matrix to the geometry normal vectors.

(m *math32.Matrix4)

Source from the content-addressed store, hash-verified

464// transform matrix to the geometry normal vectors.
465// The geometry's bounding box and sphere are recomputed if needed.
466func (g *Geometry) ApplyMatrix(m *math32.Matrix4) {
467
468 // Apply matrix to all vertices
469 g.OperateOnVertices(func(vertex *math32.Vector3) bool {
470 vertex.ApplyMatrix4(m)
471 return false
472 })
473
474 // Apply normal matrix to all normal vectors
475 var normalMatrix math32.Matrix3
476 normalMatrix.GetNormalMatrix(m)
477 g.OperateOnVertexNormals(func(normal *math32.Vector3) bool {
478 normal.ApplyMatrix3(&normalMatrix).Normalize()
479 return false
480 })
481}
482
483// Incref increments the reference count for this geometry
484// and returns a pointer to the geometry.

Callers

nothing calls this directly

Calls 6

OperateOnVerticesMethod · 0.95
GetNormalMatrixMethod · 0.95
ApplyMatrix3Method · 0.80
ApplyMatrix4Method · 0.45
NormalizeMethod · 0.45

Tested by

no test coverage detected