- #1

RichardWattUK

- 12

- 1

- TL;DR Summary
- I need to translate points on coordinate axes as part of a calculation process

**Summary:**I need to translate points on coordinate axes as part of a calculation process

Hello everyone,

I've created the diagram below to try and explain what I am trying to do as part of an existing software app that's used to generate profiles and programs to drive a CNC machine to grind worm gears.

The worm profile is translated by rotating point "A" (which is on a linear profile) in the diagram below to point "B" (which is on a curved profile more like how it will be when ground by the machine), and this curved profile is later used for some other stages in the calculation process.

_{A}and θ

_{B}represent the angle between the X axis and the outward normal vector from points A and B respectively.

There's an existing routine that uses the Newton-Raphson method to find a rotation angle β to perform this translation and is given the following values:

- Point A (x
_{A}, y_{A}, θ_{A}) - Lead measurement (in mm)
- Projection angle (γ
_{A}) - Starting values
- Point B (x
_{B}, y_{B}, θ_{B})

_{A}): α

_{A}=tan

^{-1}(Lead/(2π⋅y

_{A})), where "Lead" is the worm lead measurement.

This routine uses a Newton-Raphson loop to find a value of β that satisfies: C1 ⋅ cos β + C2 ⋅ sin β - C3 = 0 and doesn't always find a solution for all possible combinations of parameters provided by the user.

The values of C1, C2 and C3 are known before starting the iteration by calculating the following:

CA = cos α

_{A}

SA = sin α

_{A}

CG = cos γ

_{A}

SG = sin γ

_{A}

CT = -cos θ

_{A}

ST = sin θ

_{A}

C1 = SA ⋅ CG ⋅ CT

C2 = CA ⋅ CG ⋅ ST

C3 = CA ⋅ SG ⋅ CT

I've found an alternative method to calculate β by solving C1 ⋅ cos β + C2 ⋅ sin β = C3 based on the information in this Quora article.

Once I've got a value for φ from this, I use the following to work out the value of β:

φ = sin

^{-1}(C1 / √(C1

^{2}+ C2

^{2}))

If |C3 / (C1

^{2}+ C2

^{2})| Then

β = sin

^{-1}(C3 / (C1

^{2}+ C2

^{2})) - φ

Else

β = tan

^{-1}(C2 / C1) - φ

End If

SB = sin β

CB = cos β

The coordinates of point B are then calculated from:

x

_{B}= β ⋅ Lead / 2π + x

_{A}

y

_{B}= y

_{A}⋅cos β

θ

_{B}= tan

^{-1}((-CA ⋅ CT) / (CA ⋅ CB ⋅ CG ⋅ ST - SA ⋅ SB ⋅ CG ⋅ -CT)) ⋅ (180 / π)

My question is: can anyone see a better way of doing this and/or any improvements that I can make to this method?