Download Visual Traffic Simulation
Transcript
48 4.4. COMPONENT DESIGN therefore: k v= if x >= L mx + c if l < x < L 0 if x <= l From these, we can solve for m and c in terms of the three fundamental numbers k, l, and L: 1. v = mx + c 2. 0 = lm + c therefore c = −lm (A) or m = −c/l (C) 3. k = Lm + c therefore c = k − Lm (B) or m = (k − c)/L (D) 4. From A and B −lm = k − Lm therefore m = k/(L − l) 5. From C and D −c/l = (k − c)/L therefore c = kl/(l − L) These three numbers (k, l, and L) therefore, completely determine the traffic behaviour. The design decision to use the simplest model possible allows the project a wider scope in other aspects, however the model suffers in realistic factors such as drivers’ reaction times, or limits to how fast a car can brake or accelerate. Animation of cars A cars shape is a polygon. The centre of the polygon is positioned in the centre of a lane. The rotation of the polygon is dependent upon the direction of its current lane. Figure 4.13: Intersection of two lines In the Fig 4.13 the gradient of l1 is m1 and the gradient of l2 is m2 .