public override float Measure(CephalometricPointCollection points, CephalometricMeasurementCollection measurements) { var lineA = points[LineA1].Measurement - points[LineA0].Measurement; var lineB = points[LineB1].Measurement - points[LineB0].Measurement; return(MathHelper.RadiansToDegrees(Utilities.VectorAnglePerpDot(lineB, lineA))); }
public override void Draw(SpriteBatch spriteBatch, CephalometricPointCollection points, CephalometricMeasurementCollection measurements, DrawingOptions options) { if ((options & DrawingOptions.MainLines) == 0) { return; } if (!string.IsNullOrEmpty(Point0) && !string.IsNullOrEmpty(Point1) && !string.IsNullOrEmpty(Line0) && !string.IsNullOrEmpty(Line1)) { var point0 = points[Point0]; var point1 = points[Point1]; var line0 = points[Line0]; var line1 = points[Line1]; if (point0.MeasurementSpecified && point1.MeasurementSpecified && line0.MeasurementSpecified && line1.MeasurementSpecified) { var projection0 = Utilities.PointOnLine(point0.Measurement, line0.Measurement, line1.Measurement); var projection1 = Utilities.PointOnLine(point1.Measurement, line0.Measurement, line1.Measurement); spriteBatch.DrawVertices(new[] { line0.Measurement, line1.Measurement }, PrimitiveType.Lines, Color4.Orange); if ((options & DrawingOptions.ProjectionLines) != 0) { spriteBatch.DrawVertices(new[] { point0.Measurement, projection0, point1.Measurement, projection1 }, PrimitiveType.Lines, Color4.Blue); } } } }
public override void Draw(SpriteBatch spriteBatch, CephalometricPointCollection points, CephalometricMeasurementCollection measurements, DrawingOptions options) { if ((options & DrawingOptions.MainLines) == 0) { return; } if (!string.IsNullOrEmpty(Point) && !string.IsNullOrEmpty(NormalLinePoint) && !string.IsNullOrEmpty(Line0) && !string.IsNullOrEmpty(Line1)) { var point = points[Point]; var normalLinePoint = points[NormalLinePoint]; var line0 = points[Line0]; var line1 = points[Line1]; if (point.MeasurementSpecified && normalLinePoint.MeasurementSpecified && line0.MeasurementSpecified && line1.MeasurementSpecified) { var p = point.Measurement; var l0 = line0.Measurement; var l1 = line1.Measurement; var nlp0 = Utilities.PointOnLine(normalLinePoint.Measurement, line0.Measurement, line1.Measurement); var nlp1 = normalLinePoint.Measurement; var lp = Utilities.PointOnLine(point.Measurement, nlp0, nlp1); spriteBatch.DrawVertices(new[] { l0, nlp0, l1, nlp0, nlp0, nlp1, nlp0, lp, nlp1, lp }, PrimitiveType.Lines, Color4.Orange); if ((options & DrawingOptions.ProjectionLines) != 0) { spriteBatch.DrawVertices(new[] { p, lp }, PrimitiveType.Lines, Color4.Blue); } } } }
public override float Measure(CephalometricPointCollection points, CephalometricMeasurementCollection measurements) { var line0 = points[Line0].Measurement; var line1 = points[Line1].Measurement; var projection0 = Utilities.PointOnLine(points[Point0].Measurement, line0, line1); var projection1 = Utilities.PointOnLine(points[Point1].Measurement, line0, line1); return(Utilities.ScalarProjection(projection1 - projection0, Vector2.Normalize(line1 - line0))); }
public override float Measure(CephalometricPointCollection points, CephalometricMeasurementCollection measurements) { var angleSum = 0f; foreach (var angle in angles) { angleSum += measurements[angle].Measure(points, measurements); } return(angleSum); }
public override void Draw(SpriteBatch spriteBatch, CephalometricPointCollection points, CephalometricMeasurementCollection measurements, DrawingOptions options) { if ((options & DrawingOptions.MainLines) == 0) { return; } if (!string.IsNullOrEmpty(LineA0) && !string.IsNullOrEmpty(LineA1) && !string.IsNullOrEmpty(LineB0) && !string.IsNullOrEmpty(LineB1)) { var lineA0 = points[LineA0]; var lineA1 = points[LineA1]; var lineB0 = points[LineB0]; var lineB1 = points[LineB1]; if (lineA0.MeasurementSpecified && lineA1.MeasurementSpecified && lineB0.MeasurementSpecified && lineB1.MeasurementSpecified) { var pA0 = lineA0.Measurement; var pA1 = lineA1.Measurement; var pB0 = lineB0.Measurement; var pB1 = lineB1.Measurement; var normal = NormalDirection == NormalDirection.Left ? (pA1 - pA0).PerpendicularLeft : (pA1 - pA0).PerpendicularRight; var pointNormal = pA1 + normal; var intersection = Utilities.LineIntersection(pA1, pointNormal, pB0, pB1); if (intersection.HasValue) { spriteBatch.DrawVertices(new[] { pA0, pA1, pA1, pointNormal, intersection.Value + ExtensionSize * Vector2.Normalize(pointNormal - pA1), pA1, pB0, pB1, intersection.Value + ExtensionSize * Vector2.Normalize(pB1 - pB0), pB0 }, PrimitiveType.Lines, Color4.Orange); var angleIncrement = MathHelper.DegreesToRadians(Measure(points, measurements)) / (arcPoints.Capacity - 1); var axis1 = pA1 - pointNormal; var axis2 = pB0 - pB1; var direction = Utilities.CompareClockwise(axis1, axis2) < 0 ? axis1 : axis2; direction.Normalize(); for (int i = 0; i < arcPoints.Capacity; i++) { arcPoints.Add(intersection.Value + direction * 4); direction = Utilities.Rotate(direction, angleIncrement); } spriteBatch.DrawVertices(arcPoints, PrimitiveType.LineStrip, Color4.Orange); arcPoints.Clear(); } } } }
public override float Measure(CephalometricPointCollection points, CephalometricMeasurementCollection measurements) { var line0 = points[Line0].Measurement; var line1 = points[Line1].Measurement; var normalLinePoint = points[NormalLinePoint].Measurement; var normal0 = Utilities.PointOnLine(normalLinePoint, line0, line1); var normal1 = normal0 + (line1 - line0).PerpendicularRight; return(Utilities.PointLineDisplacement(points[Point].Measurement, normal0, normal1)); }
public override float Measure(CephalometricPointCollection points, CephalometricMeasurementCollection measurements) { var lineA0 = points[LineA0].Measurement; var lineA1 = points[LineA1].Measurement; var lineB0 = points[LineB0].Measurement; var lineB1 = points[LineB1].Measurement; var normal = NormalDirection == NormalDirection.Left ? (lineA1 - lineA0).PerpendicularLeft : (lineA1 - lineA0).PerpendicularRight; var pointNormal = lineA1 + normal; var intersection = Utilities.LineIntersection(lineA1, pointNormal, lineB0, lineB1).GetValueOrDefault(); return(MathHelper.RadiansToDegrees(Vector3.CalculateAngle(new Vector3(pointNormal - lineA1), new Vector3(lineB1 - lineB0)))); }
public override void Draw(SpriteBatch spriteBatch, CephalometricPointCollection points, CephalometricMeasurementCollection measurements, DrawingOptions options) { if ((options & DrawingOptions.MainLines) == 0) { return; } if (!string.IsNullOrEmpty(NormalPoint) && !string.IsNullOrEmpty(TargetPoint) && !string.IsNullOrEmpty(LineA0) && !string.IsNullOrEmpty(LineA1) && !string.IsNullOrEmpty(LineB0) && !string.IsNullOrEmpty(LineB1)) { var target = points[TargetPoint]; var normal1 = points[NormalPoint]; var lineA0 = points[LineA0]; var lineA1 = points[LineA1]; var lineB0 = points[LineB0]; var lineB1 = points[LineB1]; if (target.MeasurementSpecified && normal1.MeasurementSpecified && lineA0.MeasurementSpecified && lineA1.MeasurementSpecified && lineB0.MeasurementSpecified && lineB1.MeasurementSpecified) { var pA0 = lineA0.Measurement; var pA1 = lineA1.Measurement; var pB0 = lineB0.Measurement; var pB1 = lineB1.Measurement; var tgt = target.Measurement; var n1 = normal1.Measurement; var n0 = Utilities.PointOnLine(n1, pA0, pA1); var ptgt = Utilities.PointOnLine(tgt, pB0, pB1); var intersection = Utilities.LineIntersection(n0, n1, pB0, pB1); if (intersection.HasValue) { spriteBatch.DrawVertices(new[] { pA0, pA1, n0, intersection.Value, pB0, pB1, }, PrimitiveType.Lines, Color4.Orange); if ((options & DrawingOptions.ProjectionLines) != 0) { spriteBatch.DrawVertices(new[] { n0, intersection.Value, tgt, ptgt }, PrimitiveType.Lines, Color4.Blue); } } } } }
public override float Measure(CephalometricPointCollection points, CephalometricMeasurementCollection measurements) { var lineA0 = points[LineA0].Measurement; var lineA1 = points[LineA1].Measurement; var lineB0 = points[LineB0].Measurement; var lineB1 = points[LineB1].Measurement; var target = points[TargetPoint].Measurement; var normal1 = points[NormalPoint].Measurement; var normal0 = Utilities.PointOnLine(normal1, lineA0, lineA1); var intersection = Utilities.LineIntersection(normal0, normal1, lineB0, lineB1).GetValueOrDefault(); var targetProjection = Utilities.PointOnLine(target, lineB0, lineB1); return(Utilities.ScalarProjection(targetProjection - intersection, Vector2.Normalize(lineB1 - lineB0))); }
public override void Draw(SpriteBatch spriteBatch, CephalometricPointCollection points, CephalometricMeasurementCollection measurements, DrawingOptions options) { if ((options & DrawingOptions.DistanceLines) == 0) { return; } if (!string.IsNullOrEmpty(Point0) && !string.IsNullOrEmpty(Point1)) { var point0 = points[Point0]; var point1 = points[Point1]; if (point0.MeasurementSpecified && point1.MeasurementSpecified) { spriteBatch.DrawVertices(new[] { point0.Measurement, point1.Measurement }, PrimitiveType.Lines, Color4.Violet); } } }
public override float Measure(CephalometricPointCollection points, CephalometricMeasurementCollection measurements) { return(Utilities.PointLineDisplacement(points[Point].Measurement, points[Line0].Measurement, points[Line1].Measurement)); }
public override float Measure(CephalometricPointCollection points, CephalometricMeasurementCollection measurements) { return((points[Point1].Measurement - points[Point0].Measurement).Length); }
public virtual void Draw(SpriteBatch spriteBatch, CephalometricPointCollection points, CephalometricMeasurementCollection measurements, DrawingOptions options) { }
public abstract float Measure(CephalometricPointCollection points, CephalometricMeasurementCollection measurements);