eu.mihosoft.vrl.v3d.Modifier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcsg Show documentation
Show all versions of jcsg Show documentation
Java implementation of BSP based CSG (Constructive Solid Geometry)
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package eu.mihosoft.vrl.v3d;
/**
*
* @author Michael Hoffer <[email protected]>
*/
final class Modifier {
private final WeightFunction function;
public Modifier(WeightFunction function) {
this.function = function;
}
void modify(CSG csg) {
for(Polygon p : csg.getPolygons()) {
for(Vertex v : p.vertices) {
v.setWeight(function.eval(v.pos, csg));
}
}
}
CSG modified(CSG csg) {
CSG result = csg.clone();
modify(result);
return result;
}
}