Maintain Squared Corners

1935
7
04-24-2014 11:54 AM
ChrisRybski
New Contributor
Hello,

I'm currently working on a project where I generate houses based on setbacks from the lot edges. 

Is there a way to ensure building corners are squared to prevent distortion?

(Picture attached - problem lot in the foreground, with houses generated on ideal lots in the background.)
[ATTACH=CONFIG]33357[/ATTACH]
0 Kudos
7 Replies
MatthiasBuehler1
Frequent Contributor II
Maybe use innerRect() ?


m.
0 Kudos
ChrisRybski
New Contributor
Hi Matthias,
Thanks, yes I found the innerRect operation, and it does solve many of the issues. However!  I am still encountering issues with lots with a first edge that is not perpendicular to the shape of the lot. I've attached an image so you can see what I mean.

As you can see in the image, lots with a front edge perpendicular to the length of the lot produce an excellent rectangle (left side of image), while lots with a diagonal street edge produce a tiny rectangle. 

Is there a way that I can base the innerRect operation on the z-scope, while maintaining the first edge?

Thanks!


[ATTACH=CONFIG]33446[/ATTACH]
0 Kudos
MatthiasBuehler1
Frequent Contributor II
hi ..


this is a tricky problem, and there's no 'general' solution to this, because this is a 'design task' to decide which orientation is the best.

but for most of the cases you show, there's one solution that is quite tricky to understand and code.

you need a recursive search for the 'best scope orientation' - namely the orientation that gets you the minimal scope.sx dimension.

does that make sense ?

matt
0 Kudos
ChrisRybski
New Contributor
Thank you for the reply.
hmm sounds complicated!
Would you mind giving me a basic outline of how I might go about coding the search?  Time permitting, a it would be a nice addition to my project!
0 Kudos
LudwigFuchs
New Contributor
This sounds like a highly interesting issue since it would probably solve my problem, too - finding the smallest face (of two) facing a street on streetcrossing-corner lots using the scope orientation.
@matthiasbuehler would mind giving use some code or a resource on how this rather complicated seaarch-code is written using CGA?

Thanks
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hi,


since for this, there's no CGA operation yet, you need to 'hack it' as an approximation.

It's not too complex.

The idea is that you recursively rotate the scope n times e.g. 2 degrees and each time check the scope dimension.

the base is something like:



attr degreeDelta = 2

biggestScope(v1, v2) =
    case v1 < v2:
        v1
    else:
        v2

@Hidden
attr minimalScopeDimension = 1000000

Lot -->
    alignScopeToAxes(y)
    Recursion(90)

Recursion(remainingAngle) -->
    case remainingAngle < 0:
        print (minimalScopeDimension)
        DoneAndContinueWithTheResult.
    else:
        EvalScope(remainingAngle)

EvalScope(remainingAngle) -->
    case biggestScope(scope.sx, scope.sz) <  minimalScopeDimension:
        set(minimalScopeDimension , biggestScope(scope.sx, scope.sz) )
        EvalScope(remainingAngle - degreeDelta )
    else:
        EvalScope(remainingAngle - degreeDelta )


Did not check this code .. Just scribbled this down. If you can get this working, you'll have to add in the 'best scope rotation' as an other attribute, which you then can set, before you continue to the actual splits.

Note that n times, you only evaluate the scope dimension, you never change the geometry.

Makes sense ?

Note that you may need to set the recursion depth (prefs/general/procedural runtime) to a higher value for preciser results.


This stuff is fun to play with !!

matt
0 Kudos
ChrisRybski
New Contributor
I'll give it a shot!

Thanks a bunch, Matthias!
0 Kudos