Is a face square to the tool axis
64-bitDecides whether a picked flat or round face can be machined from the setup's tool axis.
accepted when ||n·axis| − 1| ≤ 10⁻⁹
One dot product of the face's normal (or a cylinder's axis) with the tool axis, compared with 1 at an absolute tolerance of 1e-9; both are expected to be unit vectors. For a pocket the sign of the dot product also decides whether the face looks away from the tool.
const dot = (a) => a[0] * ax[0] + a[1] * ax[1] + a[2] * ax[2];
if (f.type === 'plane') {
if (op.type === 'drill') return { why: t('mfg.why.drill_axis') };
if (Math.abs(Math.abs(dot(f.n)) - 1) > 1e-9) return { why: t('mfg.why.flat_not_square') };
if ((op.type === 'pocket' || op.type === 'adaptive') && dot(f.n) < 0) return { why: t('mfg.why.looks_away') };
return { face: hit.face };
}
if (f.type === 'cylinder') {
if (Math.abs(Math.abs(dot(f.axis.d)) - 1) > 1e-9) return { why: t('mfg.why.round_not_axis') };