MCPcopy Index your code
hub / github.com/processing/processing / computeMiter

Method computeMiter

core/src/processing/opengl/LineStroker.java:354–381  ·  view source on GitHub ↗
(int ix0, int iy0, int ix1, int iy1, int ix0p,
                            int iy0p, int ix1p, int iy1p, int[] m)

Source from the content-addressed store, hash-verified

352 // Return the intersection point of the lines (ix0, iy0) -> (ix1, iy1)
353 // and (ix0p, iy0p) -> (ix1p, iy1p) in m[0] and m[1]
354 private void computeMiter(int ix0, int iy0, int ix1, int iy1, int ix0p,
355 int iy0p, int ix1p, int iy1p, int[] m) {
356 long x0 = ix0;
357 long y0 = iy0;
358 long x1 = ix1;
359 long y1 = iy1;
360
361 long x0p = ix0p;
362 long y0p = iy0p;
363 long x1p = ix1p;
364 long y1p = iy1p;
365
366 long x10 = x1 - x0;
367 long y10 = y1 - y0;
368 long x10p = x1p - x0p;
369 long y10p = y1p - y0p;
370
371 long den = (x10 * y10p - x10p * y10) >> 16;
372 if (den == 0) {
373 m[0] = ix0;
374 m[1] = iy0;
375 return;
376 }
377
378 long t = (x1p * (y0 - y0p) - x0 * y10p + x0p * (y1p - y0)) >> 16;
379 m[0] = (int) (x0 + (t * x10) / den);
380 m[1] = (int) (y0 + (t * y10) / den);
381 }
382
383 private void drawMiter(int px0, int py0, int x0, int y0, int x1, int y1,
384 int omx, int omy, int mx, int my, int color,

Callers 1

drawMiterMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected