English

How To: Change the street direction from right-handed to left-handed in the modernStreets.cga sample

Summary

Not all streets have right-handed traffic. In about one-third of the world's countries, vehicles travel on the left side of the road. The sample modernStreets.cga that is available in the downloadable examples was created for right-handed traffic.

Instructions provided describe how to change the street direction from right-handed to left-handed in the modernStreets.cga sample.

Note:
The examples can be downloaded by going through CityEngine > Help > Download Tutorials and Examples.

Procedure

To switch the streets from right-handed to left-handed, the split function for the streets must be changed. Here are two CGA rule examples for each of the street types.

Right-handed Streets


Streetsides -->

case calcNbrOfLanes < 1.1 : Asphalt

case Nbr_of_left_lanes == 0 && Nbr_of_right_lanes == 0:

split(v,unitSpace,0){ ~calcLanesLeft : Lanes(calcNbrOfLanes,connectionEnd,0) Vehicles(0)



| Median_width : Median

| ~calcLanesRight : scaleUV(0,-1,-1) Lanes(calcNbrOfLanes,connectionStart,2) Vehicles(2) }

else:

split(v,unitSpace,0){ ~Nbr_of_left_lanes : Lanes(Nbr_of_left_lanes,connectionEnd,0) Vehicles(0)

| Median_width : Median

| ~Nbr_of_right_lanes : scaleUV(0,-1,-1) Lanes(Nbr_of_right_lanes,connectionStart,2) Vehicles(2) }

Left-handed Streets

Streetsides -->

case calcNbrOfLanes < 1.1 : Asphalt

case Nbr_of_left_lanes == 0 && Nbr_of_right_lanes == 0:

split(v,unitSpace,0){ ~calcLanesLeft : scaleUV(0,-1,-1) Lanes(calcNbrOfLanes,connectionStart,2) Vehicles(2)

| Median_width : Median

| ~calcLanesRight : Lanes(calcNbrOfLanes,connectionEnd,0) Vehicles(0)}

else:

split(v,unitSpace,0){ ~Nbr_of_left_lanes : scaleUV(0,-1,-1) Lanes(Nbr_of_left_lanes,connectionStart,2) Vehicles(2)

| Median_width : Median

| ~Nbr_of_right_lanes : Lanes(Nbr_of_right_lanes,connectionEnd,0) Vehicles(0) }