Related topic.
Even after the recent commit there are exceptions with the AT method.
As pointed out in the German topic:
The loci of center points are circles with tangent entity radius PLUS the required radius and MINUS the required radius.
Because the subtraction may become negative we normalize the locus shapes with Math.abs(...)
When that becomes zero we omit the second locus as parallel shape.
For line based shapes as tangent entity it is not well defined what to do when the point is on the line.
In that case we must include both parallels at either side of the line.
The solutions are then 2 pairs of full circular arcs.
As is, the single solution may swap sides while moving along the line.
And as pointed out:
I don't get any solutions for ellipses (Win7, Qt5.13.2, i386, QCAD Pro)
The array of intersections between an offset fitpoint RSpline and an RCircle is always empty.
For that case we must include both offset shapes (RSplines) because the inner offset may have a weird, unexpected shape.
(Thaw layer 'Construction' in the example file)
'Expected Solutions' (Dark Green) are generated with this code:
(Except the manually drawn solutions for the ellipse
Code: Select all
...
if (isNull(this.candidates)) {
this.candidates = [];
// Modification by CVH
var parallels = [];
// Include 1-2 offsets (QSharedPointer) for lineBased:
if (isLineBasedShape(this.shape1)) {
// This would convert RXLine and RRay shapes:
var line = new RLine(this.shape1.getStartPoint(), this.shape1.getEndPoint());
// Diversify between on or not on the shape:
if (line.isOnShape(this.pos, false)) { // Unlimited, RS.PointTolerance
parallels = RShape.getOffsetLines(line, this.radius, 1, RS.BothSides, RVector.invalid);
}
else {
parallels = RShape.getOffsetLines(line, this.radius, 1, RS.NoSide, this.pos);
}
}
// Include 1-2 offset shapes (RCircle) for arcs or circles:
else if (isArcShape(this.shape1) || isCircleShape(this.shape1)) {
parallels.push(new RCircle(this.shape1.getCenter(), this.radius + this.shape1.getRadius()));
// Avoid a zero radius for the second offset, normalized:
if (!RMath.fuzzyCompare(this.radius, this.shape1.getRadius())) { // RS.PointTolerance
parallels.push(new RCircle(this.shape1.getCenter(), Math.abs(this.radius - this.shape1.getRadius())));
}
}
// Include both offsets (QSharedPointer) for ellipses:
// # Issue # Not functional, ips is always empty
else if (isEllipseShape(this.shape1)) {
parallels = this.shape1.getOffsetShapes(this.radius, 1, RS.BothSides);
}
// End modification by CVH
// circle around pos:
var circle = new RCircle(this.pos, this.radius);
...
CVH