MCPcopy Create free account
hub / github.com/CNCKitchen/stlTexturizer / paintAt

Function paintAt

js/main.js:2159–2177  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

2157 const qx = ax+abx*v+acx*w-px, qy = ay+aby*v+acy*w-py, qz = az+abz*v+acz*w-pz;
2158 return qx*qx + qy*qy + qz*qz;
2159}
2160
2161/**
2162 * BFS-along-adjacency circle brush (after PrusaSlicer's TriangleSelector).
2163 *
2164 * Starts at `seedTriIdx`, walks the mesh's neighbor graph, and invokes
2165 * cb(triIdx) for every triangle that:
2166 * 1. has at least one part inside the brush "cylinder" (the projection of
2167 * a 3D distance-to-triangle test onto the plane perpendicular to
2168 * `viewDir`), AND
2169 * 2. is reachable without crossing any back-facing triangle.
2170 *
2171 * Back-face culling at the BFS expansion step is what makes this both fast
2172 * and correct: the walk can't tunnel through a thin shell to its hidden
2173 * other side because the connecting wall faces away from the camera. Work
2174 * is bounded by the painted area, not the mesh size — no spatial index
2175 * required.
2176 */
2177function bfsBrushSelect(seedTriIdx, hitPt, r2, viewDir, cb) {
2178 const usePrecision = precisionMaskingEnabled && precisionGeometry;
2179 const adjacency = usePrecision ? precisionAdjacency : triangleAdjacency;
2180 const faceNormals = usePrecision ? precisionFaceNormals : triangleFaceNormals;

Callers 1

wireEventsFunction · 0.85

Calls 8

getCurrentMeshFunction · 0.90
getCameraFunction · 0.90
_canvasNDCFunction · 0.85
getFrontFaceHitFunction · 0.85
_paintLineBetweenFunction · 0.85
_clearShiftLinePreviewFunction · 0.85
_paintSingleHitFunction · 0.85
refreshExclusionOverlayFunction · 0.85

Tested by

no test coverage detected