JavaCAD
Modifier.java
Go to the documentation of this file.
1 /*
2  * To change this license header, choose License Headers in Project Properties.
3  * To change this template file, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 
7 package eu.mihosoft.vrl.v3d;
8 
9 // TODO: Auto-generated Javadoc
15 final class Modifier {
16 
18  private final WeightFunction function;
19 
25  public Modifier(WeightFunction function) {
26  this.function = function;
27  }
28 
34  void modify(CSG csg) {
35  for(Polygon p : csg.getPolygons()) {
36  for(Vertex v : p.vertices) {
37  v.setWeight(function.eval(v.pos, csg));
38  }
39  }
40  }
41 
48  CSG modified(CSG csg) {
49  CSG result = csg.clone();
50  modify(result);
51  return result;
52  }
53 }