mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-10-26 22:10:22 +00:00
tweak
This commit is contained in:
1 parent
4983e559b3
commit
eb2468c8a5
1 file changed
+3
-6
+3
-6
@@ -310,13 +310,10 @@ public class PseudoErosionSampler implements NoiseSampler {
|
|||||||
private static double lineSdf2D(double x, double y, double x1, double y1, double x2, double y2) {
|
private static double lineSdf2D(double x, double y, double x1, double y1, double x2, double y2) {
|
||||||
double x1dx = x - x1;
|
double x1dx = x - x1;
|
||||||
double y1dx = y - y1;
|
double y1dx = y - y1;
|
||||||
|
|
||||||
double x1dxSquared = pow2(x1dx);
|
|
||||||
double y1dxSquared = pow2(y1dx);
|
|
||||||
|
|
||||||
if (x1 == x2 && y1 == y2) {
|
if (x1 == x2 && y1 == y2) {
|
||||||
// If positions are the same, just return the distance from the point
|
// If positions are the same, just return the distance from the point
|
||||||
return fastSqrt(x1dxSquared + y1dxSquared);
|
return fastSqrt(pow2(x1dx) + pow2(y1dx));
|
||||||
}
|
}
|
||||||
|
|
||||||
double ldx = x1 - x2;
|
double ldx = x1 - x2;
|
||||||
@@ -332,7 +329,7 @@ public class PseudoErosionSampler implements NoiseSampler {
|
|||||||
double lt = dotProduct / (ldySquared + ldxSquared); // Position along the line
|
double lt = dotProduct / (ldySquared + ldxSquared); // Position along the line
|
||||||
|
|
||||||
if (lt > 0) {
|
if (lt > 0) {
|
||||||
return fastSqrt(x1dxSquared + y1dxSquared); // Distance between point 1 and position
|
return fastSqrt(pow2(x1dx) + pow2(y1dx)); // Distance between point 1 and position
|
||||||
} else if (lt < -1) {
|
} else if (lt < -1) {
|
||||||
return fastSqrt(pow2(x2dx) + pow2(y2dx)); // Distance between point 2 and position
|
return fastSqrt(pow2(x2dx) + pow2(y2dx)); // Distance between point 2 and position
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user