redraw curve to reduce points
 1-20  21-24

Next
 From:  noskule
3838.1 
Hi all, Is threre a script that reduces the number of points of a curve to a minimum. If I use the offset tool with a curve the result is a curve with a lot more points then the original one. So I can't easy modify it anymore.

Thanks for any hints
Nos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Marc (TELLIER)
3838.2 
Hi Noskule,

Press tab and type "rebuild".

You can enter different values, or # of points.

You can also set a keyboard shortcut to this function.

Marc
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  noskule
3838.3 
thanks that works. I would like to build a shortcut which uses the options Mode:Refit, Tolerance 0.05, Delete input objects. The command should execute automatically without confirmation (rightclick). Is there a script template which I could use?
Thanks for any hints
nos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3838.4 In reply to 3838.3 
Hi nos, the closest thing to a script template for that would be the rebuild command script itself, it's the file Rebuild.js under the \commands sub-folder inside of MoI's main installation folder.

You would basically make a custom version of that with hard-coded values instead of the regular command which gathers those values up from the UI controls.

I've attached a version here with it set up with the parameters you wanted, to use it copy the attached NosRebuild.js command to the \commands sub-folder, that will then make a new command called NosRebuild available. You can set up a keyboard shortcut with that as the command name.

Then preselect your curve and trigger the shortcut key and it will apply the rebuild to your curve without any extra stages or UI showing.

Hope that is useful!

- Michael

EDITED: 2 Nov 2010 by MICHAEL GIBSON

Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  noskule
3838.5 
thanks I installed and works, except the "delete input" option. Do you have any idea why? True means the input get's deleted?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3838.6 In reply to 3838.5 
Hi nos, yeah true means to delete it but due to a quirk in how rebuild works there needs to be a call to factory.update() in there as well.

I've updated the attachment in the previous message to add that, please redownload it and see if that works ok now.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  noskule
3838.7 
no, seams not to work, still remaining input objects. I also restarted moi. Would this be nececarry?
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  noskule
3838.8 
ah now it works. Thank's very much. Another Question, is it possible to store customized/additional files in a separate folder (like "local"), so I can easily handle these files when updating or use it with another installation?

grz nos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3838.9 In reply to 3838.8 
Hi nos, I'm glad that works now.

> is it possible to store customized/additional files
> in a separate folder (like "local"), so I can easily handle
> these files when updating or use it with another installation?

No, there's not any way to store those into a separate folder currently, commands have to be copied into the \commands sub-folder for them to be recognized.

This is something that I want to change in the future though, to have some kind of centralized folder where you could store plug-ins and customized commands so that they could be accessed from several different versions, similar to how moi.ini is accessed for settings currently.

But for now you have to copy plug-in commands to each installation's \commands folder.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Marc (TELLIER)
3838.10 In reply to 3838.9 
Don't know if it has been mentioned before but a slider would be a nice functionality in rebuild.

It's sometime a lot of try and miss...

Marc
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  noskule
3838.11 
It would help also if the controlpoints would be located as similar to the control points of the input object as possible. No idea if that would be possible.

Second thing, if I use michaels script I can reduce the points about 3 times, after that there are no changes. Could the script be changes that I could reduce the controllpoints as long as the number of controllpoints from input and output curve match?

nos
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3838.12 In reply to 3838.10 
Hi Marc,

> Don't know if it has been mentioned before but a slider
> would be a nice functionality in rebuild.

Are you talking about having a slider for the "refit to tolerance" rebuild mode, or the "rebuild by # of sampled points" rebuild mode?

For the refit to tolerance mode, the value used is a distance tolerance value. A slider allows you to pick a range of values between 2 set values at the outside of the range, and for a tolerance value there is not really any good way to pick 2 fixed values for the slider range.

The values you use may be different depending on the scale of the object.

For instance if the slider had a range between 0.01 and 0.5, those would work well for a curve that was about 10 units across. But for a curve that was 1000 units across the entire slider range would be too small in proportion to that object.

It's difficult to have sliders on inputs that use distance values because of the scale-dependent nature of distance values.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3838.13 In reply to 3838.11 
Hi nos,

> It would help also if the controlpoints would be located
> as similar to the control points of the input object as
> possible. No idea if that would be possible.

I can't see how that would be possible - the way that rebuild in "fit to tolerance" mode works is that it constructs a new curve that tries to only follow the shape of the existing curve and not pay any attention to things like its current control point structure.

It will put more points in areas where the shape has more local details like when it goes around a tighter bend and things like that.


> Second thing, if I use michaels script I can reduce the
> points about 3 times, after that there are no changes.
> Could the script be changes that I could reduce the
> controllpoints as long as the number of controllpoints from
> input and output curve match?

If you want to have a specific control point count, you need to switch to the "Rebuild by number of sampled points" mode for that - that will allow you to specify a specific number of sample points to use, which will get sampled at evenly spaced increments along the existing curve.

The "refit to tolerance" mode uses an automated fitting process which samples points from the original curve as necessary until the rebuilt curve deviates no more than the given distance tolerance from the original.


The refit to tolerance mode does not necessarily reduce the control point count in all cases, sometimes it may even increase the point count if you are starting with a curve that has a very sparse initial control point structure. But if the curve has a dense control point structure it will usually reduce the point count by quite a bit.


Applying the refit to tolerance mode more than one time on the same curve will not really have much effect because it will give the same results for the same shape.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Marc (TELLIER)
3838.14 
Hi Michael,

It could be the number of points based on percentage where 100% would be the actual number of points, and 0% the lowest possible.

Or maybe it could work with tolerance values as well, proportional to the scale of the objects.

Like your example it could range from

0.01 and 0.5 on a curve having a length of 10
0.1 and 5 on a curve having a length of 100 and so on.

Marc
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3838.15 In reply to 3838.14 
Hi Marc,

> It could be the number of points based on
> percentage where 100% would be the actual
> number of points, and 0% the lowest possible.

But there is no limit on the upper number of points - using the Rebuild command does not really have anything to do with the current number of control points in the object. It's sort of similar to drawing a new curve with Draw curve > "Through points" and snapping the newly drawn curve on to the existing one with "on" object snap.

It's not only used for reducing the number of control points in a curve, you can also use it to increase the number of control points in a curve so that you can do more bendy edits.

Here's an example - I started with the rectangle on the left which as you can see has very sparse control points. Then I used Rebuild, # of points mode with 10 points per segment so that I could squish the rectangle around:




Rebuild can be used for more than 1 purpose like this, reducing control point count is not its only function.


> Or maybe it could work with tolerance values as well,
> proportional to the scale of the objects.

I worry a bit about using distance values in this way, it means that you can't be sure to have the same distance value used on 2 different objects.

- Michael

EDITED: 2 Nov 2010 by MICHAEL GIBSON

Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Marc (TELLIER)
3838.16 In reply to 3838.15 
Mmmhh.. I see...

I've been doing a lot of photo tracing with Moi lately (so much easier than beziers!) and sometimes a quick way to reduce points would've been nice.
I was thinking it would be great if it could work also on a selection of points.


""""""""""you can't be sure to have the same distance value used on 2 different objects"""""""""""
Maybe it could be an additional option in the command?

Marc
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3838.17 In reply to 3838.14 
Hi Marc, and here's kind of the opposite example from the last one - here is a curve that has the shape of a simple line:



But when you turn on control points, there are actually 100 control points in that curve, like this:




But rebuild does not care at all that there is 100 control points in that curve initially - rebuild only uses the shape of the curve to guide the newly constructed curve.

Trying to put some kind of special weight on trying to preserve the 100 initial messy non evenly spaced control points doesn't really make any sense here.

That's why it would not really work to try and make Rebuild be connected to the existing number of control points in the curve - that particular information just does not have anything to do with how Rebuild functions (in either mode).

- Michael

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3838.18 In reply to 3838.16 
Hi Marc,

> I was thinking it would be great if it could
> work also on a selection of points.

That would need something that worked in a completely different way than Rebuild.

That would require something that tried to manipulate the existing control point structure of the curve. That's a lot different than something that just snaps points on to the shape of the curve like Rebuild.


> Maybe it could be an additional option in the command?

Maybe, but having a lot of interconnected options and overriding things tends to make commands more complex and more difficult to use, so it's not always a good thing.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Marc (TELLIER)
3838.19 In reply to 3838.17 
Hi Michael,

Yes, It does all make sense as usual.

Maybe there could be another command?

Unmess?
PointTherapy?
LineMassage? :-)

Marc
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
3838.20 In reply to 3838.19 
Hi Marc,

> Maybe there could be another command?

Yeah, I guess since it would work pretty differently it would be a different command.

But the difficult part would be figuring out how it would work. I'm not familiar with any existing NURBS editing techniques that work in that way to reduce control point count just within a selection of existing control points.

Do you have any kind of an example that shows an input and the desired result?

If there are some kind of rules about how the desired result is generated that would then make it possible to implement it, but if the desired result is generated just by using your judgment, that is the kind of thing that is hard for an automated command to replicate.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-20  21-24