mirror of https://github.com/Chlumsky/msdfgen.git
Removed SignedDistance::INFINITE constant
This commit is contained in:
parent
64a91eec3c
commit
1b2bee7d8e
|
|
@ -2,12 +2,11 @@
|
||||||
#include "SignedDistance.h"
|
#include "SignedDistance.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cfloat>
|
||||||
|
|
||||||
namespace msdfgen {
|
namespace msdfgen {
|
||||||
|
|
||||||
const SignedDistance SignedDistance::INFINITE(-1e240, 1);
|
SignedDistance::SignedDistance() : distance(-DBL_MAX), dot(1) { }
|
||||||
|
|
||||||
SignedDistance::SignedDistance() : distance(-1e240), dot(1) { }
|
|
||||||
|
|
||||||
SignedDistance::SignedDistance(double dist, double d) : distance(dist), dot(d) { }
|
SignedDistance::SignedDistance(double dist, double d) : distance(dist), dot(d) { }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@ namespace msdfgen {
|
||||||
class SignedDistance {
|
class SignedDistance {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const SignedDistance INFINITE;
|
|
||||||
|
|
||||||
double distance;
|
double distance;
|
||||||
double dot;
|
double dot;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,19 @@
|
||||||
|
|
||||||
#include "contour-combiners.h"
|
#include "contour-combiners.h"
|
||||||
|
|
||||||
|
#include <cfloat>
|
||||||
#include "arithmetics.hpp"
|
#include "arithmetics.hpp"
|
||||||
|
|
||||||
namespace msdfgen {
|
namespace msdfgen {
|
||||||
|
|
||||||
static void initDistance(double &distance) {
|
static void initDistance(double &distance) {
|
||||||
distance = SignedDistance::INFINITE.distance;
|
distance = -DBL_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initDistance(MultiDistance &distance) {
|
static void initDistance(MultiDistance &distance) {
|
||||||
distance.r = SignedDistance::INFINITE.distance;
|
distance.r = -DBL_MAX;
|
||||||
distance.g = SignedDistance::INFINITE.distance;
|
distance.g = -DBL_MAX;
|
||||||
distance.b = SignedDistance::INFINITE.distance;
|
distance.b = -DBL_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static double resolveDistance(double distance) {
|
static double resolveDistance(double distance) {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <cfloat>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include "arithmetics.hpp"
|
#include "arithmetics.hpp"
|
||||||
|
|
||||||
|
|
@ -244,7 +245,7 @@ static double edgeToEdgeDistance(const EdgeSegment &a, const EdgeSegment &b, int
|
||||||
}
|
}
|
||||||
|
|
||||||
static double splineToSplineDistance(EdgeSegment * const *edgeSegments, int aStart, int aEnd, int bStart, int bEnd, int precision) {
|
static double splineToSplineDistance(EdgeSegment * const *edgeSegments, int aStart, int aEnd, int bStart, int bEnd, int precision) {
|
||||||
double minDistance = fabs(SignedDistance::INFINITE.distance);
|
double minDistance = DBL_MAX;
|
||||||
for (int ai = aStart; ai < aEnd; ++ai)
|
for (int ai = aStart; ai < aEnd; ++ai)
|
||||||
for (int bi = bStart; bi < bEnd && minDistance; ++bi) {
|
for (int bi = bStart; bi < bEnd && minDistance; ++bi) {
|
||||||
double d = edgeToEdgeDistance(*edgeSegments[ai], *edgeSegments[bi], precision);
|
double d = edgeToEdgeDistance(*edgeSegments[ai], *edgeSegments[bi], precision);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue