All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.mihosoft.vrl.v3d.Modifier Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
/*
 * 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;

// TODO: Auto-generated Javadoc
/**
 * The Class Modifier.
 *
 * @author Michael Hoffer <[email protected]>
 */
final class Modifier {
    
    /** The function. */
    private final WeightFunction function;

    /**
     * Instantiates a new modifier.
     *
     * @param function the function
     */
    public Modifier(WeightFunction function) {
       this.function = function;
    }
    
    /**
     * Modify.
     *
     * @param csg the csg
     */
    void modify(CSG csg) {
        for(Polygon p : csg.getPolygons()) {
            for(Vertex v : p.vertices) {
                v.setWeight(function.eval(v.pos, csg));
            }
        }
    }
    
    /**
     * Modified.
     *
     * @param csg the csg
     * @return the csg
     */
    CSG modified(CSG csg) {
        CSG result = csg.clone();
        modify(result);
        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy