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