Skip to content

Commit

Permalink
Minor cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
kduske committed Mar 4, 2024
1 parent 54bf891 commit e5ff560
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 0 additions & 4 deletions common/src/View/ExtrudeTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,6 @@ std::optional<EdgeInfo> getEdgeInfo(

const auto segment = edge->segment();
const auto dist = vm::distance(pickRay, segment);
if (vm::is_nan(dist.distance))
{
return std::nullopt;
}

const auto leftFaceIndex = edge->firstFace()->payload();
const auto rightFaceIndex = edge->secondFace()->payload();
Expand Down
2 changes: 1 addition & 1 deletion common/src/View/ScaleObjectsTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ BackSide pickBackSideOfBox(
{
const auto result =
vm::distance(pickRay, vm::segment3(points[i], points[(i + 1) % 4]));
if (!vm::is_nan(result.distance) && result.distance < closestDistToRay)
if (result.distance < closestDistToRay)
{
closestDistToRay = result.distance;
bestNormal = n;
Expand Down
3 changes: 3 additions & 0 deletions lib/vm/include/vm/distance.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "vm/segment.h"
#include "vm/vec.h"

#include <cassert>
#include <cstddef>

namespace vm
Expand Down Expand Up @@ -230,6 +231,7 @@ struct line_distance
constexpr static line_distance Parallel(
const T i_position1, const T i_distance, const T i_position2)
{
assert(!is_nan(i_position1) && !is_nan(i_distance) && !is_nan(i_position2));
return {true, i_position1, i_distance, i_position2};
}

Expand All @@ -244,6 +246,7 @@ struct line_distance
constexpr static line_distance NonParallel(
const T i_position1, const T i_distance, const T i_position2)
{
assert(!is_nan(i_position1) && !is_nan(i_distance) && !is_nan(i_position2));
return {false, i_position1, i_distance, i_position2};
}

Expand Down

0 comments on commit e5ff560

Please sign in to comment.