MCPcopy
hub / github.com/KilledByAPixel/LittleJS / debugLine

Function debugLine

src/engineDebug.js:157–166  ·  view source on GitHub ↗

Draw a debug line in world space * @param {Vector2} posA * @param {Vector2} posB * @param {Color|string} [color] * @param {number} [width] * @param {number} [time] * @param {boolean} [screenSpace] * @memberof Debug

(posA, posB, color, width=.1, time=0, screenSpace=false)

Source from the content-addressed store, hash-verified

155 * @param {boolean} [screenSpace]
156 * @memberof Debug */
157function debugLine(posA, posB, color, width=.1, time=0, screenSpace=false)
158{
159 ASSERT(isVector2(posA), 'posA must be a vec2');
160 ASSERT(isVector2(posB), 'posB must be a vec2');
161 ASSERT(isNumber(width), 'width must be a number');
162
163 const halfDelta = vec2((posB.x - posA.x)/2, (posB.y - posA.y)/2);
164 const size = vec2(width, halfDelta.length()*2);
165 debugRect(posA.add(halfDelta), size, color, time, halfDelta.angle(), true, screenSpace);
166}
167
168/** Draw a debug combined axis aligned bounding box in world space
169 * @param {Vector2} posA

Callers 9

debugRenderFunction · 0.70
engineObjectsRaycastFunction · 0.70
collisionRaycastMethod · 0.70
renderDebugInfoMethod · 0.70
raycastAllMethod · 0.50
smoothPathStringPullMethod · 0.50
findPathMethod · 0.50
gameUpdateFunction · 0.50
updateMethod · 0.50

Calls 8

isVector2Function · 0.85
isNumberFunction · 0.85
vec2Function · 0.85
lengthMethod · 0.80
ASSERTFunction · 0.70
debugRectFunction · 0.70
addMethod · 0.45
angleMethod · 0.45

Tested by

no test coverage detected