[Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

[Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby fredo6 » Wed Feb 25, 2015 10:54 pm



Convexify is a standalone script which is part of FredoTools.

It performs the decomposition of 3D shapes into Convex shapes.

Convexify operates in 3 steps:
  1. Parameters, mainly whether you wish to generate the convex shapes on a specific layer or replace the original shapes, as well as the tolerance for concavity.
  2. Calculation of Convex shapes, including alignment of face orientations
  3. Post-view to Visual Inspection. This step allows examining the generated shapes.

You can either
  • REPLACE the selection by its convex decomposition
  • or put the Convex decomposition on a specified LAYER, leaving the original shapes untouched

Convexify proceeds with the decomposition of top level geometry and all embedded groups / components in the selection at any level. It also aligns the orientation of faces in order to detect correctly the concave edges.


Convexify is installed as part of FredoTools 2.6 and above.

See the main post for this plugin for Installation of FredoTools



(see also section Quick Start and Video below)
Quickcard Convexify - English - v1.0.pdf

For developers only: There is service API to the Convexify functionality (which is actually implemented in LibFredo6).
FredoTools-Convexify API.pdf


  • SU Versions: SU6, SU7, SU8, SU13, SU14, SU15 – works better with SU8 M1 and above
  • Platforms: Windows and Mac
  • Languages: English, French
  • Menus: by default, Convexify is installed in Tools > FredoTools. There is also an entry in the Contextual menu.
  • Icon toolbar: Fredo6 Tools. There is only a single icon. By default, it is not shown. You need to go to the Default Parameters… dialog of FredoTools to enable the icon.
  • The plugin is free, for private and commercial usage.
Convexify_32.png




Convexify Overview





Launching Convexify

Just launch Convexify on a selection. If there is no selection, Convexify proposes to apply the operation to the whole active model.

You will be presented a dialog box to indicate the parameters

Convexify Dialog Box.png


Shape generation

This option allows to choose whether you wish
- to replace the original selection by its decomposition into convex shapes
- or put them on a specified layer (which will be created if it does not exist)

Note that in both cases, the hierarchy of groups / components is preserved, as well as the material and textures. Layers are also preserved if you replace the original components.

Tolerance Concavity

This parameter allows relaxing the constraint on strict concavity, which is the condition for splitting shapes into convex sub-shapes.

In the example below, the concave edge has a deviation of only 5 degree. If you set the tolerance to 5 degree or above, it will be considered convex and not split.

Convexify Concavity.png


Animation Algorithm

This parameter is really just for illustration purpose of the algorithm. If you set the delay to 0 or more seconds, then you will see a jumping cut plane splitting the shapes. The algoithm is iterative and progressively cut the shapes along their concave edges. There is an example in the video.

Convexify Animation.png


Processing

The algorithm is iterative. Therefore, when it takes time, you will be shown a Visual Panel (not a progress bar).

Convexify Progress Bar.png

The processing can be interrupted by a click or Escape (when the cursor is a green hourglass). However, when committing the operation, the processing cannot be interrupted (hourglass is red). On complex model, this step can take long, as the decomposition may generate a lot of new faces and groups.

Post-View - Visual Inspection of the Result

When the processing is complete, you are switched to an interactive tool that basically allows reviewing the result of the convex decomposition.

The button palette gives information on the original selection processed and the resulting number of convex shapes generated. It also includes some useful options for an interactive review of the convex shapes.

Convexify Palette.png

When you generate the convex shapes on a separate layer, there are a few additional buttons allowing to navigate between the Original view and the Convex view (showing only this layer)

Convexify Palette Layer.png


By default, the convex shapes are shown with color. This is purely interactive painting. The shapes receive the original material and textures if any. You have a toggle button in the palette to activate / deactivate the colorization.

Shapes which were already convex are shown in a light beige color.

There are 2 utilities for visual inspection:

Explosion of Shapes

Click on the shape to explode it into the individual convex shapes. For convenience, only the selected shape is displayed. Click again to implode.

You can adjust the speed of explosion as well as its range (explosion factor) via the buttons in the palette.

Convexify Explosion.png


Review of Non-Solid convex shapes

When the original shapes are not true solid themselves, the convex decomposition may not be able to generate true solid. In this mode, non-solid shapes are shown in Red and all others in White.

Convexify Non Solid.png



To finish, be aware that the result of a Convex decomposition may be complex too, especially when there are many concave edges. So Convexify will generally gives more aesthetical results on regular and boxy shapes. Below is a complex model (thanks to Pilou) with 320 concave edges. No miracle, the decomposition generates lot of small pieces.

Convexify Complex Explosion.png




Convexify 1.0a – 25 Feb 15: Initial public release in FredoTools 2.6a
2
Last edited by fredo6 on Thu Feb 26, 2015 9:36 pm, edited 7 times in total.
User avatar
fredo6 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby JQL » Wed Feb 25, 2015 11:32 pm

I understand that this is for games and I'm yet to know where I could use it, because I feel it could be useful for other scenarios. I'm still trying to figure out wich...

One word on the animation of parts in and out! Brilliant!
0
User avatar
JQL 
Premium Member
Premium Member
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby fredo6 » Wed Feb 25, 2015 11:35 pm

JQL wrote:I understand that this is for games and I'm yet to know where I could use it, because I feel it could be useful for other scenarios. I'm still trying to figure out wich...

I think it can also be used for Physics scripts which apparently have restrictions for computing collision better (or only) on convex shapes.

Fredo
0
User avatar
fredo6 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby Anton_S » Wed Feb 25, 2015 11:41 pm

That's amazing! Thanks for great plugin.

Do you mind if I try converting your algorithm to C++? Could be very useful for various physics engines.

Anton
0

Anton_S 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby cotty » Wed Feb 25, 2015 11:44 pm

Very nice new tool for the great Fredo tools! Thank you!
0
User avatar
cotty 
Top SketchUcator
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby fredo6 » Wed Feb 25, 2015 11:53 pm

Anton_S wrote:That's amazing! Thanks for great plugin.

Do you mind if I try converting your algorithm to C++? Could be very useful for various physics engines.

Anton

Anton,

That won't be easy from the code itself and anyway it heavily relies on Sketchup framework to describe geometry (faces, edges, etc....). The best is that I provide you with a short description of the algorithm which could be adapted to your geometrical frameworks in MSPhysics and underlying engine.

Fredo
0
User avatar
fredo6 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby Daniel S » Thu Feb 26, 2015 2:45 am

Hi Fredo!!!

This plugin can make the decomposition of 3D shapes into "pyramidal" parts?

Look at this:
http://www.3ders.org/articles/20141211- ... pport.html
http://www.math.zju.edu.cn/ruizhenhu/pr ... _small.pdf

Daniel S
0

Daniel S 
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby fredo6 » Thu Feb 26, 2015 10:39 pm

Daniel S wrote:This plugin can make the decomposition of 3D shapes into "pyramidal" parts?

I am afraid this is a very different problem, much more complex actually.
I imagine that if it does matter for 3D printing, then 3D Printing software editors would have embedded this capability in their applications.

Fredo
0
User avatar
fredo6 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby Anton_S » Fri Feb 27, 2015 10:22 am

fredo6 wrote:That won't be easy from the code itself and anyway it heavily relies on Sketchup framework to describe geometry (faces, edges, etc....). The best is that I provide you with a short description of the algorithm which could be adapted to your geometrical frameworks in MSPhysics and underlying engine.

Thank you Fredo. It seems complicated, but I'm fairly sure its possible to put together a C extension out of this. I'll look into the source and try to break it down. Otherwise, I could stick with Ruby-SketchUp implementation.

Thanks again,
Anton
0

Anton_S 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby Anton_S » Fri Feb 27, 2015 10:46 am

I decided to do a little test and got a generation error with that camel, which I got at 3dwarehouse.
Date: 27-Feb-15 01:54:52
An error occurred in Convexify 3D Shapes
Error while processing Convexify

wrong argument type (expected Sketchup::Face)

body_Lib6Solid.rb: 1212 -- reversed_in?
body_Lib6Solid.rb: 1212 -- block in solid_transfer_section_faces
body_Lib6Solid.rb: 1205 -- each
body_Lib6Solid.rb: 1205 -- solid_transfer_section_faces
body_Lib6Solid.rb: 1034 -- solid_split
body_Lib6Solid.rb: 909 -- solid_split_robot
body_Lib6Solid.rb: 560 -- robot_execute_protected
body_Lib6Solid.rb: 506 -- robot_execute
body_Lib6Solid.rb: 482 -- block in convexify
Lib6Operation.rb: 325 -- call
Lib6Operation.rb: 325 -- step_geometry
Lib6Operation.rb: 286 -- block in yield?
SketchUp: 1 -- call

Generation Options:
    Put the Convex shapes on LAYER: Fredo6_Convexify
    Tolerance Concavity: 0 deg.
    Animation algorithm: NO
A bit different error shows up when I generate with Animation set to 0.2s.

Edit: Adding next if edge0.faces.size != 2 to body_lib6Solid.rb, line 1210 (after break unless edge0) seems to fix that initial error, and generate convex decomposition without problems. However, changing tolerance makes a different error to appear. Maybe you could look into it if you have time...
0

Anton_S 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby fredo6 » Fri Feb 27, 2015 12:32 pm

Anton,

Thanks for pointing to this bug.

Actually, the correction is to replace line 1207 (an error of too quick copy / paste!)

Code: Select all
      #ledges = face.edges.sort { |e1, e2| e2.length <=> e1.length }
      ledges = ledges.sort { |e1, e2| e2.length <=> e1.length }


I'll fix and re-release, after looking at the Camel

Fredo
0
User avatar
fredo6 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby Anton_S » Fri Feb 27, 2015 9:58 pm

Thanks. I was kind of wondering whether multiple convex shapes could be combined. The algorithm generates too much convex shapes for complex models. It would be nice to have a cleanup method which then combines final convex groups if they together are still a convex shape.
0

Anton_S 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby pilou » Sat Feb 28, 2015 2:49 am

I am disapointed that the Pilou's model is not a real solid! :mrgreen:
It should because it has an external closed skin! ;)
Sure internal is maybe some convoluted! :D

So next plug will be to tranform it in a real solid! ;)

In any way another Cristallographic task! :shock: :thumb: :fro:
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby fredo6 » Sun Mar 01, 2015 12:43 pm

Anton_S wrote:Thanks. I was kind of wondering whether multiple convex shapes could be combined. The algorithm generates too much convex shapes for complex models. It would be nice to have a cleanup method which then combines final convex groups if they together are still a convex shape.

Anton,

This would be another type of decomposition (say a "blockify" method). Convexify does the job, and none of the small pièces can be combined to form a bigger convex piece. In the camel, many of the mesh quads have a diagonal that is a concave edge.

For collision, I guess that what you need is an approximate block decomposition that would be visually sufficient to give the impression of contact.

Fredo
0
User avatar
fredo6 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby fredo6 » Sun Mar 01, 2015 12:44 pm

pilou wrote:So next plug will be to tranform it in a real solid! ;)

Did you try Solid Inspector by thomthom. I think TIG also has a plugin for that.

Fredo
0
User avatar
fredo6 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby pilou » Sun Mar 01, 2015 7:11 pm

I will try that! :)
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby dkluger » Wed Jul 15, 2015 10:56 pm

I am having a problem with Convexify. I am running SU15 Make. I have this tool on another computer and it runs seamlessly. I can't figure out why it won't work on this computer.

Running the tool seems to work at first where I get prompted to use the whole model (if nothing is selected) and then I can select the convex decomposition parameters. Once I click "OK" the green hour glass comes up, but then nothing happens. The second I move my mouse, the hour glass changes to a pointer as if nothing ever happened. Any clue to what's going on here?
0

dkluger 
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby meak » Thu Jul 16, 2015 2:15 pm

hello,
Unfortunately, I have exactly the same problem.
I work with pro skecthup 2015
0

meak 
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby fredo6 » Thu Jul 16, 2015 3:17 pm

Thanks for signaling.
This is a bug introduced by LibFredo6 6.8. Sorry for inconvenience.

Please install LibFredo6 6.8c, now published on the PluginStore.

Fredo
0
User avatar
fredo6 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby meak » Fri Jul 17, 2015 2:57 pm

speed and efficiency
a big applause
thank you a lot
is it possible to keep the exploded model?
1

meak 
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby pilou » Sun Mar 26, 2017 9:24 am

Will be fine if we can exit with an actual position of the animation Explode Convexify colored view!
(with colors or not)
Or does exist a trick ?
(sure I can use other thing like Explode-view, Animator, ... but that give not the colors etc...

GIF_fine.gif
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby pilou » Thu Mar 30, 2017 9:16 am

Seems there is a glitch!
convex_glitch.jpg
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby gilles » Thu Mar 30, 2017 10:18 am

It's seems to be relative with angular tolerance.

Glitch_Convex_V6.png
0
" c'est curieux chez les marins ce besoin de faire des phrases "
User avatar
gilles 
Top SketchUcator
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby gilles » Thu Mar 30, 2017 10:28 am

But I may be wrong…

Glitch_Convex.png
0
" c'est curieux chez les marins ce besoin de faire des phrases "
User avatar
gilles 
Top SketchUcator
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby pilou » Thu Mar 30, 2017 12:55 pm

Even more evident for 2 simple circles extruded! :o
Dashed lines should be the good ones!

simple_cercle.jpg
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby fredo6 » Thu Mar 30, 2017 2:46 pm

Pilou,

This is normal.

The corresponding vertices of the inner and outer circles are not 'aligned', that is, the line joining two corresponding vertices does not go through the common center of the circles.

This is a frequent issue when drawing co-centric circles. Because they are made of segments, it may important to keep them 'aligned'. I must say that the Circle tool does not help too much for that.

If Convexify was 'following' your edges in the current model, the pieces would not be convex or would have to be divided in smaller chunks.

Fredo
0
User avatar
fredo6 
PluginStore Author
PluginStore Author
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby pilou » Thu Mar 30, 2017 3:41 pm

That is some ennoyous! :)
So we must found a trick!
Because make drawings with concentric Circles or Arc-circle are very commune! :ugeek:
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

Re: [Plugin] FredoTools::Convexify - v1.0 - 25 Feb 15

Postby pilou » Thu Mar 30, 2017 4:08 pm

Ok I found one :)

Drawing concentric circles on the same alignment! :)

here the red axe!

GIF_same_align.gif


PS Now if you can exit during the animation for keept the position of objects & colors
that will be cool! :)
0
Frenchy Pilou
Is beautiful that please without concept!
Speedy Galerie
User avatar
pilou 
Top SketchUcator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

cron

Who is online

Users browsing this forum: Mynameispanama and 13 guests

Visit our sponsors: