package org.opentrafficsim.demo.ntm; import java.awt.geom.Point2D; import java.util.ArrayList; /** *
* Copyright (c) 2013-2017 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License.
*
* $LastChangedDate$, @version $Revision$, by $Author$,
* initial version 9 Sep 2014
* @author Alexander Verbraeck
* @author Hans van Lint
* @author Peter Knoppers
* @author Guus Tamminga
* @author Yufei Yuan
*/
public class LinearFunctionLibrary
{
/**
* An example (PieceWiseLinear) is shown below:
*
*
* production * | * Y | _____________________ * | / \ * | / \ * | / \ * | / \ * | / \ * |/________________________________\__________ density (number of vehicles) * ^ ^ * x1 x2 x3 **
* @param xyPairs ArrayList<Point2D>; point that define the curve
* @param valueX double; provides te value to execute (returns the Y-value)
* @return the Y value of a valueX
*/
public static double createPieceWiseLinear(final ArrayList