[PLUGIN] Polygon (update 2013-04-23)

Post your completed addons to share with the community

Post » Sun Apr 17, 2016 9:50 am

Hey @Yann I know you aren´t as active around here nowadays, but I´ve been using a program outside C2 called Metaplot and was wondering if your plugin could be capable of loading vector shapes made with it, as it exports .json but just in a different syntax.

(Apart from vertex, Metaplot draws lines and is capable of inserting metadata to differ parts of the drawing)

Thanks in advance

Edit: Added a comparison between the plugin´s export syntax and Metaplot´s

Polygon plugin:
{"c2polygon":true,"vertexCount":4,"vertices":[[15,-15],[-15,-15],[-15,15],[15,15]]}

Metaplot .json:
{
"verts": [
{"x": -30.000000, "y": -40.000000, "hasMeta": false, "metaIndex": 0},
{"x": -30.000000, "y": 30.000000, "hasMeta": false, "metaIndex": 0},
{"x": 40.000000, "y": 30.000000, "hasMeta": false, "metaIndex": 0},
{"x": 40.000000, "y": -40.000000, "hasMeta": false, "metaIndex": 0}
],
"lines": [
{"idx1": 0, "idx2": 1, "hasMeta": false, "metaIndex": 0},
{"idx1": 1, "idx2": 2, "hasMeta": false, "metaIndex": 0},
{"idx1": 2, "idx2": 3, "hasMeta": false, "metaIndex": 0},
{"idx1": 3, "idx2": 0, "hasMeta": false, "metaIndex": 0}
],
"metas": [

]
}
B
9
S
3
Posts: 149
Reputation: 1,262

Post » Sat Jun 04, 2016 12:50 pm

Hey, just curious, @Yann, when you created your 3D application of the polygon plugin, did you just throw in quarternians to tell it where to put vertices? I've been trying to apply it that way, but I'm getting some weird effects. (almost looks like an extra, uncreated vertice?) And the frame rate drops when each poly is drawn. Not by much though, it won't be hard for me to work around that. I'm just curious as to how you applied it.
ImageImage
B
43
S
13
G
2
Posts: 249
Reputation: 6,205

Post » Mon Dec 12, 2016 9:00 am

🎊🎇🎉🎈🙌𝓦𝓞𝓡𝓚𝓢 𝓐𝓜𝓐𝓩𝓘𝓝𝓖!🙌🎈🎉🎇🎊 behaviors and effects seems to work perfect. The only thing it seems to be missing is the ability to add it to families in C2. This is something I really needed for my main project.
B
51
S
26
G
8
Posts: 121
Reputation: 8,501

Post » Thu Dec 15, 2016 8:19 am

@Yann is it possible to draw a circle using your polygon plugin and could you please provide an Capx example with JSON polygon importing? Preferably a circle XD.

@CloveltOc yeah that would be awesome if it supported Metaplot, or vise versa.
B
51
S
26
G
8
Posts: 121
Reputation: 8,501

Post » Wed Dec 21, 2016 3:43 pm

A circle isn't a polygon. You can approximate a circle using a regular polygon with a lot of sides
I won't provide a capx, 'cause I'm lazy, but the pseudocode would look like:

Code: Select all
sides  = 32
radius = 100
pos_x  = 200
pos_y  = 300

angle_step = 360 / sides
for i from 0 to sides:
     angle = angle_step * i
     x = pos_x + cos(angle) * radius
     y = pos_y + sin(angle) * radius
     addVertex(x,y)


something like that.
B
64
S
22
G
14
Posts: 1,482
Reputation: 16,457

Post » Wed Dec 21, 2016 10:14 pm

Was there ever a feature added to this plugin to fill the polygon with a sprite or a texture?
B
6
S
3
G
2
Posts: 104
Reputation: 1,960

Post » Fri Dec 23, 2016 5:46 am

Yann wrote:A circle isn't a polygon. You can approximate a circle using a regular polygon with a lot of sides
I won't provide a capx, 'cause I'm lazy, but the pseudocode would look like:

Code: Select all
sides  = 32
radius = 100
pos_x  = 200
pos_y  = 300

angle_step = 360 / sides
for i from 0 to sides:
     angle = angle_step * i
     x = pos_x + cos(angle) * radius
     y = pos_y + sin(angle) * radius
     addVertex(x,y)


something like that.


One neither is a square, but they can both be formed with polygons. Two, yeah or the following with the polygon plugin:
Code: Select all
"x": 59.000000, "y": 53.000000
"x": 50.702869, "y": 93.947128
"x": 27.074638, "y": 128.660431
"x": -8.287506, "y": 151.855103
"x": -50.000000, "y": 160.000000
"x": -91.712494, "y": 151.855103
"x": -127.074638, "y": 128.660431
"x": -150.702866, "y": 93.947128
"x": -159.000000, "y": 53.000000
"x": -150.702866, "y": 12.052873
"x": -127.074638, "y": -22.660425
"x": -91.712494, "y": -45.855110
"x": -50.000000, "y": -54.000000
"x": -8.287506, "y": -45.855110
"x":27.074638, "y": -22.660425
"x": 50.702869, "y": 12.052873


You could also form a hectogon and get a nice circular shape as well.
B
51
S
26
G
8
Posts: 121
Reputation: 8,501

Previous

Return to Completed Addons

Who is online

Users browsing this forum: vzad and 5 guests