Here you can find the source of clampToMinusOneToOne(float value)
public static float clampToMinusOneToOne(float value)
//package com.java2s; /*/* ww w . j a va2s.c o m*/ * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2007-2008, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ public class Main { /** * Clamps the given value to the -1..1 range. */ public static float clampToMinusOneToOne(float value) { if (value < -1) { value = -1; } if (value > 1) { value = 1; } return value; } }