1 package org.opentrafficsim.road.gtu.lane.object; 2 3 import org.djunits.unit.LengthUnit; 4 import org.djunits.value.vdouble.scalar.Length; 5 import org.opentrafficsim.core.geometry.OTSGeometryException; 6 import org.opentrafficsim.core.geometry.OTSLine3D; 7 import org.opentrafficsim.road.network.lane.CrossSectionElement; 8 9 /** 10 * <p> 11 * Copyright (c) 2013-2015 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 12 * BSD-style license. See <a href="http://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>. 13 * </p> 14 * $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, 15 * initial version Nov 26, 2015 <br> 16 * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a> 17 * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a> 18 */ 19 public class CSEBlock extends AbstractCSEObject 20 { 21 22 /** 23 * @param geometry the geometry of the object 24 * @param height the height of the object 25 */ 26 public CSEBlock(final OTSLine3D geometry, final Length.Rel height) 27 { 28 super(geometry, height); 29 } 30 31 /** 32 * @param cse the cross section element, e.g. lane, where the block is located 33 * @param position the relative position on the design line of the link for this block 34 * @return a new CrossSectionElementBlock on the right position on the cse 35 * @throws OTSGeometryException in case the position is outside the CSE 36 */ 37 public static CSEBlock createCrossSectionElementBlock(final CrossSectionElement cse, final Length.Rel position) 38 throws OTSGeometryException 39 { 40 return new CSEBlock(AbstractCSEObject.createRectangleOnCSE(cse, position, 41 new Length.Rel(0.5, LengthUnit.METER), cse.getWidth(position).multiplyBy(0.8), new Length.Rel(0.5, 42 LengthUnit.METER)), new Length.Rel(1.0, LengthUnit.METER)); 43 } 44 }