1 package org.opentrafficsim.core.egtf; 2 3 /** 4 * Kernel with maximum range and shape. 5 * <p> 6 * Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 7 * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>. 8 * <p> 9 * @version $Revision$, $LastChangedDate$, by $Author$, initial version 24 okt. 2018 <br> 10 * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a> 11 */ 12 public class Kernel 13 { 14 15 /** Maximum spatial range. */ 16 private final double xMax; 17 18 /** Maximum temporal range. */ 19 private final double tMax; 20 21 /** Shape of the kernel. */ 22 private final KernelShape shape; 23 24 /** 25 * Constructor. 26 * @param xMax double; maximum spatial range 27 * @param tMax double; maximum temporal range 28 * @param shape KernelShape; shape of the kernel 29 */ 30 Kernel(final double xMax, final double tMax, final KernelShape shape) 31 { 32 this.xMax = xMax; 33 this.tMax = tMax; 34 this.shape = shape; 35 } 36 37 /** 38 * Returns a weight assuming given propagation speed. 39 * @param c double; assumed propagation speed 40 * @param dx double; distance between measurement and estimated point 41 * @param dt double; time between measurement and estimated point 42 * @return double; weight assuming given propagation speed 43 */ 44 final double weight(final double c, final double dx, final double dt) 45 { 46 return this.shape.weight(c, dx, dt); 47 } 48 49 /** 50 * Returns the from location of the valid data range. 51 * @param x double; location of estimated point 52 * @return double; from location of the valid data range 53 */ 54 final double fromLocation(final double x) 55 { 56 return x - this.xMax; 57 } 58 59 /** 60 * Returns the to location of the valid data range. 61 * @param x double; location of estimated point 62 * @return double; to location of the valid data range 63 */ 64 final double toLocation(final double x) 65 { 66 return x + this.xMax; 67 } 68 69 /** 70 * Returns the from time of the valid data range. 71 * @param t double; time of estimated point 72 * @return double; from time of the valid data range 73 */ 74 final double fromTime(final double t) 75 { 76 return t - this.tMax; 77 } 78 79 /** 80 * Returns the to time of the valid data range. 81 * @param t double; time of estimated point 82 * @return double; to time of the valid data range 83 */ 84 final double toTime(final double t) 85 { 86 return t + this.tMax; 87 } 88 89 /** {@inheritDoc} */ 90 @Override 91 public String toString() 92 { 93 return "Kernel [tMax=" + this.tMax + ", xMax=" + this.xMax + ", shape=" + this.shape + "]"; 94 } 95 96 }