Draw segment hull.

This commit is contained in:
Michael Bebenita 2017-10-29 15:13:55 -07:00
parent a7056460d0
commit 45755816c8
1 changed files with 12 additions and 1 deletions

View File

@ -53,6 +53,7 @@ const LIGHT_STROKE_STYLE: string = "rgb(192, 192, 192)";
const LINE_STROKE_STYLE: string = "rgb(0, 128, 0)"; const LINE_STROKE_STYLE: string = "rgb(0, 128, 0)";
const CURVE_STROKE_STYLE: string = "rgb(128, 0, 0)"; const CURVE_STROKE_STYLE: string = "rgb(128, 0, 0)";
const SEGMENT_CONTROL_POINT_STROKE_STYLE: string = "rgb(0, 0, 128)"; const SEGMENT_CONTROL_POINT_STROKE_STYLE: string = "rgb(0, 0, 128)";
const SEGMENT_CONTROL_POINT_HULL_STROKE_STYLE: string = "rgba(128, 128, 128, 0.5)";
const NORMAL_STROKE_STYLES: NormalStyleParameter<string> = { const NORMAL_STROKE_STYLES: NormalStyleParameter<string> = {
bVertex: '#e6aa00', bVertex: '#e6aa00',
@ -449,8 +450,18 @@ function drawSegmentVertices(context: CanvasRenderingContext2D,
drawSegmentVertex(context, position0, invScaleFactor); drawSegmentVertex(context, position0, invScaleFactor);
drawSegmentVertex(context, position1, invScaleFactor); drawSegmentVertex(context, position1, invScaleFactor);
if (controlPoint != null) if (controlPoint != null) {
context.save();
context.strokeStyle = SEGMENT_CONTROL_POINT_HULL_STROKE_STYLE;
context.setLineDash([2 * invScaleFactor, 2 * invScaleFactor]);
context.beginPath();
context.moveTo(position0[0], -position0[1]);
context.lineTo(controlPoint[0], -controlPoint[1]);
context.lineTo(position1[0], -position1[1]);
context.stroke();
context.restore();
drawSegmentControlPoint(context, controlPoint, invScaleFactor); drawSegmentControlPoint(context, controlPoint, invScaleFactor);
}
drawNormal(context, position0, normal0, invScaleFactor, 'edge'); drawNormal(context, position0, normal0, invScaleFactor, 'edge');
drawNormal(context, position1, normal1, invScaleFactor, 'edge'); drawNormal(context, position1, normal1, invScaleFactor, 'edge');