Some SDF functions
This commit is contained in:
parent
c633fe8549
commit
17663dac02
12 changed files with 197 additions and 0 deletions
18
src/main/java/ru/betterend/util/sdf/primitive/SDFSphere.java
Normal file
18
src/main/java/ru/betterend/util/sdf/primitive/SDFSphere.java
Normal file
|
@ -0,0 +1,18 @@
|
|||
package ru.betterend.util.sdf.primitive;
|
||||
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.util.sdf.ISDF;
|
||||
|
||||
public class SDFSphere implements ISDF {
|
||||
private float radius;
|
||||
|
||||
public SDFSphere setRadius(float radius) {
|
||||
this.radius = radius;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDistance(float x, float y, float z) {
|
||||
return MHelper.length(x, y, z) - radius;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue