Select to view content in your preferred language

Rules

8009
41
Jump to solution
01-18-2013 10:06 AM
NicoleHanson
Deactivated User
I think there's a step in my rule somewhere that doesn't take into account the number of lanes I have.  On one stretch of road, it's one lane going in one direction.  But I have two lanes of cars after applying the rule.  Any idea where I can find out how to get this fixed?
0 Kudos
41 Replies
MatthiasBuehler1
Deactivated User
Hi !

that would be the next step in the rule at the current state.

e.g.
placing cars would use an other UV-split to cut a thin line on which cars. same can then be done with sidewalks to distribute trees or street furniture.


if you have point features in ArcGIS, you'd just insert assets via on these positions via i() in CGA.

makes sense ?

let me know when you understood most of the code, then we can add some more details to it.

m.
0 Kudos
NicoleHanson
Deactivated User
I'm starting to understand more of the code.  I've also been looking at other example codes from the tutorials. 

Thanks so much for helping me!

Oh, another question.  When entering the number of vehicles per km, what if I have numbers for the number traveled per mile, but it's the average daily totals?
0 Kudos
MatthiasBuehler1
Deactivated User
It all boils down to some statistical math where you calculate how many car objects you place on the lanes.

Quite easy to calculate if you already have the numbers ..

The person who did the Modern Streets Example just set up the function so that he can enter the 'traffic density' basically.


Btw. you should re-code the whole thing from scratch to get a hang of it. 🙂

We can then later on also place cars with your numbers.

M.
0 Kudos
NicoleHanson
Deactivated User
I'm getting there!  Can I cut and paste different lines from other rules?


OK, so I've made a list of attributes, that I know I want right now.  Some of the roads don't have a median, so how would the fuction look for that.  Would it be the case, else (if, than) statements? 

Also, with having a shoulder, do I need to designate left and right on that, like I do with the lanes?

Here's what my attributes look like so far:
## Attributes

attr Lanes_Left = 2
attr Lanes_Right = 2
attr Lane_Width = 3.5
attr Shoulder_Width = 3
attr Median_Width = 1.5
0 Kudos
MatthiasBuehler1
Deactivated User
btw. use the TEXT editor to author the rules.


if a median is done or not .. for that I'd make a 'boolean' attr.

I've done this in my example code :
attr doMedian = true



yes, you can use copy paste, but only if the code works. you'll get errors otherwise.

using ctrl-f, you can search your code. search my code for all places, where 'doMedian' is used.

Note the case :

case doMedian :
    ..
else :
    .. 
0 Kudos
MatthiasBuehler1
Deactivated User
and note :

the 'Model' is created based on the 'Shape'.

So a street graph defined the width of the total street shape. So since the total width is already give plus using the fact that 1 lane is about 3 meters wide, n lanes can actually be created.

e.g. a 9 meter wide shape can produce 3 lanes.

so that can be 1 left lane and 2 right lanes. But since the total width of the street is given and thus drives the total number of lanes, it makes 'no sense' to define

attr Lanes_Left = 2
attr Lanes_Right = 2


makes sense ?

the laneOffset I have in my code then defines the offset :

e.g. if 5 lanes can be produced, 2 left and 3 right can be produced. an offset of 1 makes 1 left and 4 right lanes.

makes sense too ?

m.
0 Kudos
NicoleHanson
Deactivated User
and note :

the 'Model' is created based on the 'Shape'.

So a street graph defined the width of the total street shape. So since the total width is already give plus using the fact that 1 lane is about 3 meters wide, n lanes can actually be created.

e.g. a 9 meter wide shape can produce 3 lanes.

so that can be 1 left lane and 2 right lanes. But since the total width of the street is given and thus drives the total number of lanes, it makes 'no sense' to define

attr Lanes_Left = 2
attr Lanes_Right = 2


makes sense ?

the laneOffset I have in my code then defines the offset :

e.g. if 5 lanes can be produced, 2 left and 3 right can be produced. an offset of 1 makes 1 left and 4 right lanes.

makes sense too ?

m.


No, it doesn't make sense.  Most of the roads I will be modeling are 2 and 2.  Except for the interstate which is one way, but goes from 2 - 4 lanes. 

I would have to enter the total width then to accomidate for that, if I do it how the sample code is, right?
0 Kudos
MatthiasBuehler1
Deactivated User
Hi !

[ATTACH=CONFIG]21781[/ATTACH]

In the image you see the streetWidth street parameter which defines the width of the street shape.

So in your case, you would set this value to ( 2 + 2 ) * 3m = 12m first.

Then you use CGA to split into the amount of lanes which result ( 2+2 ).

This workflow is set because you must set the streetwidth in the first place to even get the street shapes.


A little additional detail which may help you :
split() {~ .. }* splits into even parts. The little star symbolizes a 'repetitive' split. The tilde (~) sign evens out the dimensions. That means the combination makes the split result in a full number of lanes for each side, no matter how wide the street is.

ok ?

m.
0 Kudos
NicoleHanson
Deactivated User
I think so. 

So after I set the split () {~...}*, I then can have a line that has the offset, or a line of code that has the one ways for those areas that are not evenly split on lanes?


Also, when I'm seeting my Median function, for the color can I use one of the textures in my assets folder?  ex: color (Shoulder_tex)   where Shoulder_tex is defined from the assets?
0 Kudos
MatthiasBuehler1
Deactivated User
Hi ..

These 3 examples ( StartRules Street1, Street2, Street3 ) should show what the ideas are behind the splitting strategies.

Run the code and check what the code produces. See the image attached.

[ATTACH=CONFIG]21828[/ATTACH]



attr width_1 = 5

Street1 -->
 split(v,unitSpace,0){width_1 : Red | ~1 : Green}



attr myLaneWidth = 3

Street2 -->
 split(v,unitSpace,0){width_1 : Red | ~1 : RestShape}

RestShape -->
 split(v,unitSpace,0){~myLaneWidth : Green }*


attr medianWidth = 1

Street3 -->
 split(v,unitSpace,0){~1 : MultiLane | medianWidth : Green | ~1 : MultiLane}

MultiLane -->
 split(v,unitSpace,0){~myLaneWidth : Red }*


Red -->
 color(1,0,0)

Green -->
 color(0,1,
0 Kudos