diff options
| author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2023-03-25 22:14:03 +0900 |
|---|---|---|
| committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2023-03-25 22:14:03 +0900 |
| commit | 968d8a86f5a7e08f71bd449a466cc467efb11e3d (patch) | |
| tree | bfd82936edd7439e48412a43892340ea25b5a672 /src/Person.cpp | |
| parent | d7f9a74f75ba0ce2167fa0e529a009becdcee7e3 (diff) | |
| download | blackshades-968d8a86f5a7e08f71bd449a466cc467efb11e3d.tar.gz | |
Convert square of norm calculation to Zig
Diffstat (limited to 'src/Person.cpp')
| -rw-r--r-- | src/Person.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Person.cpp b/src/Person.cpp index 452a8bd..292269a 100644 --- a/src/Person.cpp +++ b/src/Person.cpp @@ -60,7 +60,7 @@ HitStruct Person::BulletCollideWithPlayer(int who, XYZ start, XYZ end){ float distancemax = 0.0f; for (auto& joint : skeleton.joints) distancemax = std::max(distancemax, - findDistancefast(average, joint.position)); + sqrlen(average - joint.position)); distancemax = sqrt(distancemax); //Collide with player @@ -932,7 +932,7 @@ int Person::DrawSkeleton(int who) for (auto& joint : skeleton.joints) { joint.oldposition = joint.position; joint.position += joint.offset; - if (findLengthfast(joint.offset) >= multiplier * multiplier * 25) { + if (sqrlen(joint.offset) >= multiplier * multiplier * 25) { normal = normalize(joint.offset); skeleton.offset = 1; joint.offset -= normal * multiplier * 5; |
