divide vector object

General Moho topics.

Moderators: Víctor Paredes, Belgarath, slowtiger

capndreamer
Posts: 2
Joined: Sat Jul 23, 2011 11:02 am

divide vector object

Post by capndreamer »

Hi All,

Newbie here. I am just starting out with AS8. I wanted to know if there is a way to divide a single vector object into multiple parts? Example: Split a circle into 12 equal pie shaped parts. I can't find any info in the manual.

Thank you!
Rudiger
Posts: 786
Joined: Sat Dec 17, 2005 5:25 pm

Post by Rudiger »

You could try using the new Break Apart Shapes menu script (under Layer Effects). It's mainly designed for distributing shapes across multiple layers, but you can also restrict it to a single layer. Here are the steps you would go through to split a circle into 12 equal pie shaped parts:

1. Draw circle without fill or stroke enabled
2. Go to Scripts -> Draw -> Split Curve...
Set Point count to 2 and hit OK.
3. Use the Add Point with Auto-weld enabled to draw the pie shaped segments. To find the center point you could copy and paste the circle and scale it down until it is just a dot. You will also probably have to set the curvature of the center point to "Peak" using the Curvature tool.
4. Use the Paint Bucket tool to quickly go around and fill each segment with the fill and stroke colors you want.
5. Select the circle and go to Scripts -> Draw -> Split Curve... again.
Set Point count to 2 and hit OK.
6. Select all of the points and go to Scripts -> Layer Effects -> RT: Break Apart Shapes. Select "Put all shapes in one layer" and check "Create separate geometry for each shape".
7. This will create the separated shapes on their own layer. If they look right, you can delete the selected points on the current layer and copy and paste them from the new layer, then delete the new layer.

And that's it. You should now be able to move the segments separately from each other.
Last edited by Rudiger on Sun Jul 24, 2011 1:37 am, edited 1 time in total.
User avatar
GCharb
Posts: 2280
Joined: Sun Oct 09, 2005 6:31 pm
Location: Montreal, Quebec, Canada
Contact:

Post by GCharb »

An easy way to create a center point would be to creat the circle, connect the top and bottom point to make a line, select the top and bottom points then use the split curve with 1 as value, creates a point right at the center.
User avatar
GCharb
Posts: 2280
Joined: Sun Oct 09, 2005 6:31 pm
Location: Montreal, Quebec, Canada
Contact:

Post by GCharb »

Followed rudiger instructions and came up with this.

Image

File here, asp 8.

http://www.mediafire.com/?dsxiw28v8xg8wv5
Rudiger
Posts: 786
Joined: Sat Dec 17, 2005 5:25 pm

Post by Rudiger »

That looks cool, but how do we know the shapes are actually separate? Care to do a short Physics animation, where something crashes into it or something?
User avatar
funksmaname
Posts: 3174
Joined: Tue May 29, 2007 3:31 am
Location: New Zealand

Post by funksmaname »

lol

Image
Rudiger
Posts: 786
Joined: Sat Dec 17, 2005 5:25 pm

Post by Rudiger »

Hehe, nice!
capndreamer
Posts: 2
Joined: Sat Jul 23, 2011 11:02 am

Post by capndreamer »

Thank you all! This works great! :D
User avatar
GCharb
Posts: 2280
Joined: Sun Oct 09, 2005 6:31 pm
Location: Montreal, Quebec, Canada
Contact:

Post by GCharb »

funksmaname wrote:lol

Image
ROFL, will try one of mine.

Also made it somewhat simpler last night.

Draw circle.

Connect middle points.

Select middle points then apply split curve with 1 as point count to create center point.

Select circle without center point.

Apply split curve with 8 as point count.

Create the parts of the pie.

Select all the parts one by one with the select tool while holding ALT(lasso tool)

Pasted all parts in another layer.

Used Create Shape tool to fill them.

Worked perfect, was a fun little project :)
User avatar
GCharb
Posts: 2280
Joined: Sun Oct 09, 2005 6:31 pm
Location: Montreal, Quebec, Canada
Contact:

Post by GCharb »

Rudiger
Posts: 786
Joined: Sat Dec 17, 2005 5:25 pm

Post by Rudiger »

GCharb wrote:
funksmaname wrote:lol

Image
ROFL, will try one of mine.

Also made it somewhat simpler last night.

Draw circle.

Connect middle points.

Select middle points then apply split curve with 1 as point count to create center point.

Select circle without center point.

Apply split curve with 8 as point count.

Create the parts of the pie.

Select all the parts one by one with the select tool while holding ALT(lasso tool)

Pasted all parts in another layer.

Used Create Shape tool to fill them.

Worked perfect, was a fun little project :)
I take it by "simpler", you meant "script-free". Surely there would have been more steps involved in manually copying and pasting each shape to the new layer than just running a menu script once only.

Cool animation, though. I think I might have to do my own now :).
User avatar
GCharb
Posts: 2280
Joined: Sun Oct 09, 2005 6:31 pm
Location: Montreal, Quebec, Canada
Contact:

Post by GCharb »

Well, not script free, since the split curve script was used.

By simpler, I meant easier to understand for a noobie with little or no script knowledge.

Have not played much with the physics engine, I even complained about it being a new feature but I must admit it was fun! :)

Thanks for the animation, and yes you should make your own, just for the fun of it! :)
User avatar
funksmaname
Posts: 3174
Joined: Tue May 29, 2007 3:31 am
Location: New Zealand

Post by funksmaname »

Gilles, your animation is vastly superior to mine lol
The physics is 'fun' but it ONLY works on things set up in frame 0. if the floor moves after frame 0 for example, everything will just land on the invisble floor... which is a shame...
User avatar
GCharb
Posts: 2280
Joined: Sun Oct 09, 2005 6:31 pm
Location: Montreal, Quebec, Canada
Contact:

Post by GCharb »

funksmaname wrote:Gilles, your animation is vastly superior to mine lol
Thanks, took 10 minutes really.
funksmaname wrote: The physics is 'fun' but it ONLY works on things set up in frame 0. if the floor moves after frame 0 for example, everything will just land on the invisble floor... which is a shame...
I see, that's too bad. Still, there could be fun stuff to be made with it, like the motor function, one could do all sort of sprocket contraption, have the camera pan through tons of gears then at the end, an Easter egg comes out of a tube, silly stuff Wallace and Gromit style!
User avatar
InfoCentral
Posts: 935
Joined: Fri May 26, 2006 12:35 pm
Location: Los Angeles, CA

Post by InfoCentral »

GCharb wrote:Thanks, took 10 minutes really.
There you go another quick tutorial in the works for the blog!
Post Reply