Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Core/GameEngine/Source/GameClient/System/ParticleSys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3454,16 +3454,17 @@ void ParticleSystemDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp )
// ------------------------------------------------------------------------------------------------
static Real angleBetween(const Coord2D *vecA, const Coord2D *vecB)
{
if (!(vecA && vecA->length() && vecB && vecB->length())) {
return 0.0;
const Real lengthA = vecA->length();
const Real lengthB = vecB->length();

if (!(lengthA && lengthB)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this should be !(vecA || vecB) before their use, or can they not be null at any point?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I looked at call sites and they were not null, so I omitted null tests. I can relook.

return 0.0f;
}

Real lengthA = vecA->length();
Real lengthB = vecB->length();
Real dotProduct = (vecA->x * vecB->x + vecA->y * vecB->y);
Real cosTheta = dotProduct / (lengthA * lengthB);

// If the dotproduct is 0.0, then they are orthogonal
// If the dot product is 0.0, then they are orthogonal
if (dotProduct == 0.0f) {
if (vecB->x > 0) {
return PI;
Expand Down
Loading