makeSegmentWithBevelJoin method

dynamic makeSegmentWithBevelJoin(
  1. dynamic joinIsOnLeftSide,
  2. dynamic innerSideModified,
  3. dynamic u,
  4. dynamic u1,
)

Implementation

makeSegmentWithBevelJoin(joinIsOnLeftSide, innerSideModified, u, u1) {
  if (innerSideModified) {
    // Optimized segment + bevel triangles

    if (joinIsOnLeftSide) {
      // Path segments triangles

      addVertex(lastPointR, u0, 1);
      addVertex(lastPointL, u0, 0);
      addVertex(currentPointL, u1, 0);

      addVertex(lastPointR, u0, 1);
      addVertex(currentPointL, u1, 0);
      addVertex(innerPoint, u1, 1);

      // Bevel join triangle

      addVertex(currentPointL, u, 0);
      addVertex(nextPointL, u, 0);
      addVertex(innerPoint, u, 0.5);
    } else {
      // Path segments triangles

      addVertex(lastPointR, u0, 1);
      addVertex(lastPointL, u0, 0);
      addVertex(currentPointR, u1, 1);

      addVertex(lastPointL, u0, 0);
      addVertex(innerPoint, u1, 0);
      addVertex(currentPointR, u1, 1);

      // Bevel join triangle

      addVertex(currentPointR, u, 1);
      addVertex(nextPointR, u, 0);
      addVertex(innerPoint, u, 0.5);
    }
  } else {
    // Bevel join triangle. The segment triangles are done in the main loop

    if (joinIsOnLeftSide) {
      addVertex(currentPointL, u, 0);
      addVertex(nextPointL, u, 0);
      addVertex(currentPoint, u, 0.5);
    } else {
      addVertex(currentPointR, u, 1);
      addVertex(nextPointR, u, 0);
      addVertex(currentPoint, u, 0.5);
    }
  }
}