Milling Speeds And Feeds: Charts & Data - feed per tooth
The angleBetweenLines has a problem, though. The result is always positive. I need to detect both positive and negative angles, so if one line is 15 degrees "above" or "below" the other line, the shape obviously looks different.
Chamfer bevel dental
Chamfering involves cutting or grinding away a small portion of the edge of the board at a 45-degree angle. This results in a beveled edge that is less sharp and less likely to catch on other materials or objects. Chamfering is often used on the corners of a PCB to prevent damage during handling or installation. It can also be used to create a visual effect, such as giving the board a more polished or finished appearance.
@duffymo's answer is correct, but if you don't want to implement cross-product, you can use the atan2 function. This returns an angle between -π and π, and you can use it on each of the lines (or more precisely the vectors representing the lines).
Chamfered edge wood
On the other hand, beveling involves cutting or grinding away a larger portion of the edge of the board at an angle other than 45 degrees. This results in a sloped edge that can be used for specific purposes, such as fitting the board into a particular shape or housing. Beveling can also be used to reduce the overall size of the board while maintaining functionality, or to create a more aerodynamic shape for applications such as drone or UAV electronics.
In the printed circuit board (PCB) industry, chamfering and beveling are two common techniques used to modify the edges of the board. While the two terms may be used interchangeably in some contexts, they are actually distinct processes with different purposes and outcomes.
Chamfered edge vs rounded edge
This is exactly what the cross-product is for. The sign of the 3rd component is positive for counter-clockwise and negative for clockwise (as you look down at the plane of rotation).
The configuration I have is that one line remains stationary, while the other line rotates, and I need to understand what direction it is rotating in, by comparing it with the stationary line.
This is an easy problem involving 2D vectors. The sine of the angle between two vectors is related to the cross-product between the two vectors. And "above" or "below" is determined by the sign of the vector that's produced by the cross-product: if you cross two vectors A and B, and the cross-product produced is positive, then A is "below" B; if it's negative, A is "above" B. See Mathworld for details.
Beveled edge
How to improve the algorithm so it returns the angle as both positive or negative depending on how the lines are positioned?
EDIT: in response to swestrup's comment below, the situation is actually that I have a single line, and I record its starting position. The line then rotates from its starting position, and I need to calculate the angle from its starting position to current position. E.g if it has rotated clockwise, it is positive rotation; if counterclockwise, then negative. (Or vice versa.)
Check the sign of the 3rd component. If it's positive, A is "below" B; if it's negative, A is "above" B - as long as the two vectors are in the two quadrants to the right of the y-axis. Obviously, if they're both in the two quadrants to the left of the y-axis the reverse is true.
You need to think about your intuitive notions of "above" and "below". What if A is in the first quadrant (0 <= θ <= 90) and B is in the second quadrant (90 <= θ <= 180)? "Above" and "below" lose their meaning.
Bevel vs chamfer vs fillet
If you get an angle θ for the first (stationary line), you'll have to normalize the angle φ for the second line to be between θ-π and θ+π (by adding ±2π). The angle between the two lines will then be φ-θ.
Just noticed that the function actually converts the Rads to Degrees as it returns the value. But the same principle will work.
Chamfered corner
If you are asking to have that one function return both values at the same time, then you are asking to break the language, a function can only return a single value. You could pass it two pointers that it can use to set the value of so that the change can persist after the frunction ends and your program can continue to work. But not really a sensible way of solving this problem.
Chamfered edge
The line then rotates from its starting position, and I need to calculate the angle from its starting position to current position. E.g if it has rotated clockwise, it is positive rotation; if counterclockwise, then negative. (Or vice versa.)
One 'quick and dirty' method you can use is to introduce a third reference line R. So, given two lines A and B, calculate the angles between A and R and then B and R, and subtract them.
Here's the implementation of brainjam's suggestion. (It works with my constraints that the difference between the lines is guaranteed to be small enough that there's no need to normalize anything.)
In summary, chamfering and beveling are both edge modification techniques commonly used in the PCB industry. Understanding the difference between these two techniques can help PCB manufacturers choose the most appropriate method for their specific needs.