Jump to content

2d planet gravity


Recommended Posts

So basically the plugin should work just like the gravity plugin by MadJik but the gravity should be concentrated at one point (see pictures, i tried to recreate it manually). Please code the plugin with Codelab and send me the script, I want to use it for my other plugin. imma credit you. The plugin should also work for non circular shapes.

 

 

test.png

Edited by Foxxey
Link to comment
Share on other sites

3 hours ago, Foxxey said:

Please code the plugin with Codelab and send me the script, I want to use it for my other plugin. imma credit you.

 

Um, that's not how it works. If someone feel like doing this, then they'll do it. However, I think this is a rather interesting idea. I know how to replicate it via g'mic-qt though that's not what you want and it's very easy for me to do this. I could modify this code of mine and insert it as a new filter.

 

For reference:

 

 

#@cli rep_pstrk: eq. to 'rep_perspective_streak' : (+)
rep_pstrk: rep_perspective_streak $*
#@cli rep_perspective_streak: -1<=_xpos<=1,-1<=_ypos<=1,-1<=_alpha_exponential_factor,0<_distance_threshold<=1,0<_distance_start<=1,_direction={ 0=in | 1=out },_streak_mode={ 0=color | 1=gray | 2=binary | 3=gray+binary },_preserve_edges={ 0=do_not_preserve_edges | 1=preserve_edges }
#@cli : Create perspective streak effect. _preserve_details only is applicable on non-binary mode.
#@cli : (eq. to 'rep_pstrk').\n
#@cli : Default values: '_xpos=0','_ypos=0','_alpha_exponential_factor=1','_distance_threshold=1','_distance_start=0','_direction=0','_streak_mode=0','_preserve_edges=1'
rep_perspective_streak:
skip ${1=0},${2=0},${3=0},${4=1},${5=0},${6=0},${7=0},${8=1}
point={[$1,$2]}
if !$4 error "$4|"$"4>0" fi
repeat $! l[$>]
    if s!=3
        echo "Applying perspective streak at coordinate point $point!"
        if h>w orientation=1
        else orientation=0
        fi
        if s>1
            sh. 0,{s-2}
            +channels.. {s#0-1}
            f. i==0?1:0
            inpaint_pde.. .
            rm[-2,-1]
        fi
        rep_recpoltrans $point,-3
            if $5>0&&$5<1 f begin(sy=1/(((1-$5)*h)/h););i(x,y*sy,z,c,2); fi
            if $7||s==1
                channels {s-1}
                if $8
                    if $7==3||$7==1 . n. 0,1 l. +f 1 rv a c endl store. details
                    else echo "Details cannot be preserved using binary mode!"
                    fi
                fi
                rep_axis_streak 1,!$6,$3
                if $4>0&&$4<1
                    f i>(1-$4)?i:(1-$4)
                    n 0,1
                fi
                if $7==2 f i>0?1:0
                elif $7==3 +f i>0?1:0 a c fi
                if $8
                    if $7==3||$7==1
                        $details
                        s. c,-{s-1}
                        j[-3] [-2],0,0,0,0,1,[-1],1
                        rm[-2,-1]
                    fi
                fi
            else
                if $8 +store details fi
                if $4>0&&$4<1
                    +channels {s-1}
                    rep_axis_streak. 1,!$6,$3
                    f. i>(1-$4)?i:(1-$4)
                    f. i>im#-1?1:0
                fi
                rep_axis_streak[0] 1,!$6,$3
                if $4>0&&$4<1
                    sh[0] {s#0-1}
                    f. i0#-2*i
                    k[0]
                fi
                if $8
                    $details
                    s. c,-{s-1}
                    j[-3] [-2],0,0,0,0,1,[-1],{iM#-1}
                    rm[-2,-1]
                fi
            fi
        rep_recpoltrans $point,2,$orientation
    else echo "Not applicable to images with 3 channels!"
    fi
endl done

 

 

Between rep_recpoltrans I can modify the code to use rep_sptbwgp which is my extended version of MadJik's Gravity plugin. After that it's erasing irrelevant line. It's easy for me to do something like this.

 

Also, for more information on rep_recpoltrans (the code there is outdated though as I have made better implementation with the reverse transformation as well) - https://discuss.pixls.us/t/geometry-help-rectangular-polar-transformation-from-cartesian-or-to-cartesian-solved-or-nearly-solved/15060

 

I hope I provided enough information on how your plugin would probably work like.

Edited by Reptillian

G'MIC Filter Developer

 

I am away from this forum for undetermined amount of time: If you really need anything related to my PDN plugin or my G'MIC filter within G'MIC plugin, then you can contact me via Paint.NET discord, and mention me.

Link to comment
Share on other sites

After making the g'mic-qt version, I"m genuinely surprised at the benefit the idea of the OP has. It works best with geometric art.

 

Using a public domain image - https://publicdomainvectors.org/en/free-clipart/Triangular-floral-frame-in-shades-of-green-drawing/34586.html

 

And the result of the gmic-qt implementation of this idea.

 

cgDz0bI.png

Edited by Reptillian
  • Like 1
  • Upvote 1

G'MIC Filter Developer

 

I am away from this forum for undetermined amount of time: If you really need anything related to my PDN plugin or my G'MIC filter within G'MIC plugin, then you can contact me via Paint.NET discord, and mention me.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...