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

com.ardor3d.math.functions.CheckerFunction3D Maven / Gradle / Ivy

/**
 * Copyright (c) 2008-2012 Ardor Labs, Inc.
 *
 * This file is part of Ardor3D.
 *
 * Ardor3D is free software: you can redistribute it and/or modify it 
 * under the terms of its license which may be found in the accompanying
 * LICENSE file or at .
 */

package com.ardor3d.math.functions;

import com.ardor3d.math.MathUtils;

/**
 * A simple checker board pattern, with each unit cube alternating between -1 and 1 in value.
 */
public class CheckerFunction3D implements Function3D {

    public double eval(final double x, final double y, final double z) {
        if ((MathUtils.floor(x) + MathUtils.floor(y) + MathUtils.floor(z)) % 2 == 0) {
            return -1;
        } else {
            return 1;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy