The brightness flower (demo 5 on my website)

If you have a design you're proud of, share the cfdg file here. It's also a good place to ask for feedback and collaborate.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
User avatar
chris
Site Admin
Posts: 72
Joined: Wed May 04, 2005 10:57 am
Location: New York, NY
Contact:

The brightness flower (demo 5 on my website)

Post by chris »

This is just a test post. Currently it's my favorite I've generated, and it demos both the brightness and weighting features. See it rendered here:

http://chriscoyne.com/cfdg/page6.php

------------------------

startshape SEED1

rule SEED1 {
SQUARE{}
SEED1 {y 1.0 size 0.99 rotate 1.5 brightness 0.02}
}

rule SEED1 0.05 {SEED2 {}}

rule SEED2 {
SQUARE{}
SEED2 {y 1.0 size 0.99 rotate -1.5}
}

rule SEED1 0.05 {SEED1 {}}

rule SEED1 0.05 {
SQUARE{}
SEED2 {y 1.0 size 0.99 rotate 1.5}
SEED1 {y 1.0 size 0.6 rotate -60}
SEED2 {y 1.0 size 0.5 rotate 60}
}

rule SEED2 0.05 {
SQUARE{}
SEED1 {y 1.0 size 0.99 rotate 1.5}
SEED2 {y 1.0 size 0.6 rotate -60}
SEED1 {y 1.0 size 0.5 rotate 60}
}

User avatar
emrainey
Posts: 6
Joined: Fri May 06, 2005 9:37 am
Location: Dallas, TX
Contact:

Wow

Post by emrainey »

I haven't gotten the hang of creating smooth curves yet. I'm tempted to write an external app to compute a nice long curve with no jittery square corners butting in.
e.m.rainey

The next remark is false.
The previous remark is true.

User avatar
chris
Site Admin
Posts: 72
Joined: Wed May 04, 2005 10:57 am
Location: New York, NY
Contact:

Re: Wow

Post by chris »

emrainey wrote:I haven't gotten the hang of creating smooth curves yet. I'm tempted to write an external app to compute a nice long curve with no jittery square corners butting in.
Try this. It'll generate a whole bunch of smooth spirals.

Code: Select all


#include <iostream>
#include <sstream>
#include <cmath>

using namespace std;
const float PI = 3.14159;

float cleanFloat(float f) {
    if (f < 0.001 && f > -0.001)
        return (0);
    else
        return (f);
}

int main () {

    float scale_num;
    float scale_den;
    float ang_num;
    float ang_den;

    for (scale_den = 100; scale_den <= 100; scale_den++) {
        for (scale_num = 90; scale_num <= 110; scale_num++) {
            for (ang_den = 1; ang_den <= 1; ang_den++) {
                for (ang_num = -5; ang_num <= 5; ang_num+=1) {
                    ostringstream name;
                    float b = scale_num / scale_den;
                    float angle = ang_num / ang_den;
                    float theta = PI * ang_num / ang_den / 180;



                    if (theta < 0) {
                        float adj_theta = theta + PI/4;
                        name << "curveright_"
                             << cleanFloat(b) << "_"
                               << cleanFloat(-angle);

                        cout << "\n\n rule "
                             << name.str()
                             << " {"
                             << "\n SQUARE { } "
                             << "\n " << name.str()
                             << " { rotate "
                             << cleanFloat(angle)
                             << " size "
                             << cleanFloat(b)
                             << " x "
                             << cleanFloat((-1.0/2.0)
                                           + (sqrt(b*b/2))*cos(adj_theta))
                             << " y "
                             << cleanFloat((1.0/2.0)
                                           + (sqrt(b*b/2))*sin(adj_theta))
                             << " }\n}";
                    }

                    else {
                        float adj_theta = theta +3*PI/4;
                        name << "curveleft_" << cleanFloat(b) << "_"
                             << cleanFloat(angle);

                        cout << "\n\nrule "
                             << name.str()
                             << " {"
                             << "\n SQUARE { } "
                             << "\n " << name.str()
                             << " { rotate "
                             << cleanFloat(angle)
                             << " size "
                             << cleanFloat(b)
                             << " x "
                             << cleanFloat((1.0/2.0)
                                           + (sqrt(b*b/2))*cos(adj_theta))
                             << " y "
                             << cleanFloat((1.0/2.0)
                                           + (sqrt(b*b/2))*sin(adj_theta))
                             << " }\n}";
                    }
                }
            }
        }
    }
}

Current Project: I'm creative director of OKCUPID at http://www.okcupid.com

Post Reply