Exit Full View
Up

/Garden/GardenPath2.foocad

GardenPath2
FooCAD Source Code
import static uk.co.nickthecoder.foocad.layout.v1.Layout2d.*
import static uk.co.nickthecoder.foocad.layout.v1.Layout3d.*

class GardenPath : Model {
    
    override fun build() : Shape3d {
        val endY = 6100
        val endRight = 3120
        val doorCenterX = 1530
        val straightY = 1900 + 0 // 3340

        val end = Cube( 600, 100, 1 ).rightTo( endRight ).backTo( endY )

        val door = Cube( 600, 100, 1 ).centerXTo( 1530 ).frontTo(0)

        val brickH = Square( 200, 100 ).offset(-4).margin(4).extrude(50)
        val brickV = Square( 100, 200 ).offset(-4).margin(4).extrude(50)

        val x3 = brickH.tileX(3)
        val y6 = brickV.tileX(6)
        val line2 = brickV + brickH.tileY(2).tileX(2).leftTo(100) + brickV.rightTo(600)
        
        val threshold = x3.rightTo( endRight ).frontTo(endY).topTo(-50)

        val step1 = y6.rightTo( endRight ).backTo(endY)
        val step2 = line2.rightTo( endRight ).backTo(step1.front)
        val step = (step1 + step2).bottomTo( threshold.top )
            .color("DarkRed")
        
        val last = line2.rightTo( endRight ).backTo( step.front )
            .color("FireBrick")
        val first = Cube( 600, straightY, 50 ).centerXTo( doorCenterX )
            .color("FireBrick")

        val foo = 1800 //1700
        val radius = 2600 //2500

        val curve = PolygonBuilder().apply{
            moveTo( first.middle.x, first.back )
            bezierBy(
                Vector2( 0, foo ),
                Vector2( 0, foo ),
                Vector2( last.middle.x - first.middle.x, last.front - first.back )
            )
        }.buildPath()
        val curve3d = curve.thickness( 600 ).extrude( 50 )

        val circle1 = Circle( radius ).leftTo(first.right).centerYTo(first.back)
        val circle2 = circle1.rightTo( last.left ).centerYTo( last.front)
        val circles = (circle1+circle2).extrude(100).previewOnly()

        val stones = Cube( first.right, 3340, 1 ).color("Grey")

        println( "Circles :\n    ${circle1.middle}\n    ${circle2.middle}" )
        return threshold + step + last + first + door + curve3d + circles + stones
    }
}