Jump to content

Recommended Posts

More fun 13.lesson.

 

untitled_231.thumb.jpg.fe6347abe737b2c127a4771135b47871.jpguntitled_230.thumb.jpg.372401f42384428407f16909341f8633.jpguntitled_229.thumb.jpg.1949e069fc22987e4e4f3fde9fb156bb.jpguntitled_228.thumb.jpg.c9e3a77cfb3571ae203c0a0c176b5a3e.jpguntitled_227.thumb.jpg.ca741fc36ca674dd74dfff3022634680.jpg

 

projectione.h




/*! \fn vector2 one_sphere(vector2 z; float r)
    \brief Project \f$z \in C\f$ to \f$S^1\f$.

    Project \f$z \in C\f$ to \f$S^1\f$ with radius \f$r\f$.

    \param z the direction in \f$C\f$ to project to \f$S^1\f$
    \param r the radius of \f$S^1\f$

    \return the point \f$z \frac{r}{\mid z \mid}\f$
*/
vector2 one_sphere(vector2 z; float r) {
    return z / length(z) * r;
}

/*! \fn vector two_sphere(vector z; float r)
    \brief Project \f$z \in R^3\f$ to \f$S^2\f$.

    Project \f$z \in R^3\f$ to \f$S^2\f$ with radius \f$r\f$.

    \param z the direction in \f$R^3\f$ to project to \f$S^2\f$
    \param r the radius of \f$S^2\f$

    \return the point \f$z \frac{r}{\mid z \mid}\f$
*/
vector two_sphere(vector z; float r) {
    return z / length(z) * r;
}

/*! \fn vector2 stereo2(vector c)
    \brief Stereographic projection from \f$S^2\f$.

    Stereographic projection from  \f$S^2\f$ into \f$C\f$.

    \param c the vector in \f$S^2\f$ to project into \f$C\f$, , must not be
        \f$(0, 0, 1)\top\f$

    \return the stereographic projection to \f$C\f$
*/
vector2 stereo2(vector c) {
    float x = c.x;
    float y = c.y;
    float z = c.z;
    return set(x, y) / (1-z);
}

/*! \fn vector stereo3(vector4 c)
    \brief Stereographic projection from \f$S^3\f$.

    Stereographic projection from  \f$S^3\f$ into \f$R^3\f$.

    \param c the vector in \f$S^3\f$ to project into \f$R^3\f$, must not be \f$(0, 0, 0, 1)\top\f$

    \return the stereographic projection to \f$R^3\f$
*/
vector stereo3(vector4 c) {
    float x = c.x;
    float y = c.y;
    float z = c.z;
    float w = c.w;
    return set(x, y, z) / (1-w);
}

/*! \fn vector4 stereo3_inv(vector c)
    \brief Inverse of the stereographic projection from \f$S^3\f$.

    Inverse from \f$R^3\f$ into \f$S^3\f$ of the stereographic projection.

    \param c the vector in \f$R^3\f$ to reproject into \f$S^3\f$.

    \return the projection into \f$S^3\f$
*/
vector4 stereo3_inv(vector c) {
    float x = c.x;
    float y = c.y;
    float z = c.z;
    return set(2*x, 2*y, 2*z, length2(c)-1) / (length2(c)+1);
}

vector stereo3_e4(vector4 c) {
    return set(c.x, c.y, c.z) / (1.-c.w);
}
vector stereo3_e4_inv(vector c) {
    return set(2*c.x, 2*c.y, 2*c.z, length2(c)-1) / (length2(c)+1.);
}

/*! \fn vector sphere_inversion(vector z; vector center; float scale)
    \brief Sphere inversion

    Perform a Möbius tranformation to project every point inside the the unit
    sphere in \f$R^3\f$ to outside and vice versa.

    \param z the original vector in \f$R^3\f$
    \param center the center of the sphere
    \param scale the radius of the sphere

    \return the inverted vector
*/
vector sphere_inversion(vector z; vector center; float scale) {
    // Compute translation, then transform in the origin and retranslate
    vector translation = set(center.x, center.y, center.z);
    vector transformed = z - translation;
    return transformed / length2(transformed) * pow(scale, 2) + translation;
}

complex.h

*! \fn vector2 cmul(vector2 z; vector2 w)
    \brief Multiply two complex numbers

    Multiply two arbitrary complex numbers.

    \param z first factor
    \param w second factor
    \return \f$z \cdot w\f$
*/
vector2 cmul(vector2 z; vector2 w) {
    float x = z.x;
    float y = z.y;
    float u = w.u;
    float v = w.v;
    float real = x*u - y*v;
    float imaginary = x*v + y*u;
    return set(real, imaginary);
}


/*! \fn vector2 cdiv(vector2 w; vector2 z)
    \brief Divide one complex number by another complex number

    Divide one arbitrary complex number by another non-zero complex number.

    \param w divident
    \param z divison

    \return \f$\frac{w}{z}\f$
*/
vector2 cdiv(vector2 w; vector2 z) {
    float x = z.x;
    float y = z.y;
    float u = w.u;
    float v = w.v;
    float divisor = pow(x, 2) + pow(y, 2);
    float real = (u*x + v*y) / divisor;
    float imaginary = (v*x - u*y) / divisor;
    return set(real, imaginary);
}


/*! \fn vector2 cpow(vector2 z; int n)
    \brief Compute the \f$n\f$-th power of a complex number

    Compute the \f$n\f$-th power of a complex number, for \f$n \in N\f$.

    \param z the complex number
    \param n the exponent

    \return \f$z^n\f$
*/
vector2 cpow(vector2 z; int n) {
    float x = z.x;
    float y = z.y;
    float r = length(z);
    float phi = atan2(y, x);
    return pow(r, n) * set(cos(n*phi), sin(n*phi));
}

/*! \fn float real(vector2 z)
    \brief Give the real part of a complex number

    Give the real part of a complex number represented by the first component
    of a two element vector.

    \param z the complex number

    \return the real part \f$a\f$ of \f$z = a + ib\f$
*/
float real(vector2 z) {
    return z.x;
}

/*! \fn float img(vector2 z)
    \brief Give the imaginary part of a complex number

    Give the imaginary part of a complex number represented by the second
    component of a two element vector.

    \param z the complex number

    \return the imaginary part \f$b\f$ of \f$z = a + ib\f$
*/
float img(vector2 z) {
    return z.y;
}

/*! \fn vector2 e_to_the_is(float s)
    \brief Give a point on the one-sphere.

    Give a point on the one-sphere parameterized by \f$s\f$ in the parametric
    form.

    \param s the real parameter

    \return the point \f$(\cos s, \sin s) \subset C\f$
*/
vector2 e_to_the_is(float s) {
    return set(cos(s), sin(s));
}
vector4 f;
p@f;
float n = chi("n");
float k = chi("k");

int j = @ptnum;

float cosine = cos(($PI*j) / (2.*n));
float sine = sin(($PI*j) / (2.*n));
vector2 cosine_exp = cosine * e_to_the_is($PI - $PI/(k+1));
vector2 exp_neg = e_to_the_is(- $PI/4);
vector2 exp_pos = e_to_the_is($PI/4);
vector2 sine_exp_neg = sine * exp_neg;
vector2 sine_exp_pos = sine * exp_pos;

float j_mod_4n = j % (4*n);

if( j_mod_4n < n ) {
    f.x = cosine;
    f.y = 0;
    f.z = real(sine_exp_neg);
    f.w = img(sine_exp_neg);
} else {
    if( j_mod_4n < 2 * n ) {
        f.x = real(cosine_exp);
        f.y = img(cosine_exp);
        f.z = real(sine_exp_neg);
        f.w = img(sine_exp_neg);
    } else {
        if( j_mod_4n < 3 * n ) {
            f.x = real(cosine_exp);
            f.y = img(cosine_exp);
            f.z = real(sine_exp_pos);
            f.w = img(sine_exp_pos);
        } else {
            if( j_mod_4n < 4 * n ) {
                f.x = real(cosine);
                f.y = 0;
                f.z = real(sine_exp_pos);
                f.w = img(sine_exp_pos);
            } else {
                f.x = cosine;
                f.y = 0;
                f.z = real(sine_exp_pos);
                f.w = img(sine_exp_pos);
            }
        }
    }
}

p@f = f;

 

vfeee.jpg

  • Like 7

Share this post


Link to post
Share on other sites

Cool, I really like the last one,and also the second one :)

Share this post


Link to post
Share on other sites

Im feel in good progression but you are running fast, love this last one Tesan. Feel like looking at a kinetic sculpture

 

Share this post


Link to post
Share on other sites
5 hours ago, Librarian said:

make stones-make patterns have fun (H 16.5)

 

org.jpg

pappp.jpg

stijene.hipnc

Wow!  You make me want to 3dprint my underwear :D

Which renderer is this Tesan?

 

  • Haha 1

Share this post


Link to post
Share on other sites

Cool, especially the second one, has a nice feel to it, still life.. :) Me liky

  • Thanks 1

Share this post


Link to post
Share on other sites

Power of the 2 grid endless patterns ( Qlib also) Attribut Shape + modulo+ after+attributeblur oj oj :wacko:

Have fun

145558.jpg.2ec162605d3cfd82108074184abe7e50.jpg14777778.jpg.c8f5893f3d580ba3dcca0a91a053b8d7.jpg14777777777887.jpg.7c93db80304982c0449273daa4ee914b.jpgDcs.jpg.498cf3556812c3bd237b9873efb07a50.jpgdersss.jpg.d3503eef215878b541b9ae49559f6167.jpg

untitled_235.thumb.jpg.b38f40cc2b9a13fd77db0c5f8b22e91d.jpg

EXp.hipnc

  • Like 3

Share this post


Link to post
Share on other sites

between lessons

I know what I need. Just need to learn how to have more control with normals  ( using here add to the floor and different bias with gLib -Dev). Just crazy about little critters :wacko:..that I gonna implement to this

 

add12.gif

add1.gif

add.gif

  • Like 1

Share this post


Link to post
Share on other sites

This its final lesson and I think for those who don't know about this code it gonna open a lot of Fun and understanding about colors and what it can be achieved  (a salute to Dude Satoru Yonekura..@yone80@github for CODE).almost 3 yrs old file

Basically it takes a value of the gray and makes a Spline mMMMmmmmm (endless possibility )  don't mind in which axis (Alllllll)

I use here qLIb for manipulation of shapes and attribute (for you gonna see):rolleyes:......

If you combine with already made stuff And many tutorials on the net and here you can make absolutely everything.(archy, biology, modeling complex stuff, having fun with CNC, having fun with particles,  ...........etc

I have 10000 files ( on the subject) ..you gonna get 3  :P don't need more trust me

 

I just provide IMAGINE :wub:

examples

https://www.instagram.com/cnc_verkstad/

Sorry for any errors I use H 16.5 :blush:

 

01555.jpg

Have_fun.hipnc

  • Thanks 1

Share this post


Link to post
Share on other sites

man, this patterns are from another world! I've also tried some stuff with complex number patterns, namely the mandelbrot set and mandelbulb but this is unbelievable!

Share this post


Link to post
Share on other sites

Have Fun @Kalonyan

You can make everything trust me  :wub:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×