06-27-2016, 09:39 PM
In creating some tools, I was pleased with the simplicity and elegance of calculating the angle between two points with an expression such as
It plotted the points and angles exactly as I'd expect. Then I experimented with the angle constrain functions and am completely baffled.
When I put the points p1 and p2 into vector, then into a path and drag the mouse, the resultant line and angle change as I drag, but with some seemingly random relationship to the point where I'm dragging in terms of either angle or distance, with or without the "nearest45" option.
It seems to have a mind of its own, regardless of which quadrant I'm in. I'd really appreciate any tips on this. In most instances, I just want to flip an object either north or south of the primary angle, or in some cases east-west as well, i.e., snap to either 1/4 or 1/8 radian to orient my new art object in terms of direction (90 or 180 degree increments from the artAngle), reversing it to be right- or left-handed as needed.
Any guidance would be very much appreciated! -- rj
Code:
artAngle = (gxg.startPt^gxg.endPt);
It plotted the points and angles exactly as I'd expect. Then I experimented with the angle constrain functions and am completely baffled.
Code:
p1 = gxg.mouseDownPt;
dragDist(gxg.mouseDownPt|gxg.endPt);
artAngle = (gxg.mouseDownPt^gxg.endPt);
if (shiftDown) artAngle = artAngle.nearest45();
p2 = gxg.mouseDownPt.LengthAngle(dragDist, artAngle);
When I put the points p1 and p2 into vector, then into a path and drag the mouse, the resultant line and angle change as I drag, but with some seemingly random relationship to the point where I'm dragging in terms of either angle or distance, with or without the "nearest45" option.
It seems to have a mind of its own, regardless of which quadrant I'm in. I'd really appreciate any tips on this. In most instances, I just want to flip an object either north or south of the primary angle, or in some cases east-west as well, i.e., snap to either 1/4 or 1/8 radian to orient my new art object in terms of direction (90 or 180 degree increments from the artAngle), reversing it to be right- or left-handed as needed.
Any guidance would be very much appreciated! -- rj