Revert "Replace sqrt in Dimension by Fast inverse square root"
All checks were successful
continuous-integration/drone/push Build is passing

This reverts commit 497d2173e8.
This commit is contained in:
Siklos 2022-08-15 16:00:04 +02:00
parent 497d2173e8
commit 5b20e4f2dc
2 changed files with 2 additions and 24 deletions

View file

@ -1,6 +1,5 @@
import * as React from 'react';
import { NOTCHES_LENGTH } from '../../../utils/default';
import { Qrsqrt } from '../../../utils/math';
interface IDimensionProps {
id: string
@ -33,8 +32,8 @@ export const Dimension: React.FC<IDimensionProps> = (props: IDimensionProps) =>
const [deltaX, deltaY] = [(props.xEnd - props.xStart), (props.yEnd - props.yStart)];
// Get the unit vector
const inv = Qrsqrt(deltaX * deltaX + deltaY * deltaY);
const [unitX, unitY] = [deltaX * inv, deltaY * inv];
const norm = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
const [unitX, unitY] = [deltaX / norm, deltaY / norm];
// Get the perpandicular vector
const [perpVecX, perpVecY] = [unitY, -unitX];