Clothoid 2 point curve script
 1-12  13-32  33-35

Previous
Next
 From:  bemfarmer
5878.13 In reply to 5878.12 
Thank you BurrMan.

I was just comparing the curve to a 2d Blend curve.

I wonder what code it would take to Bind and move an end point around?

- Brian
  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:  bemfarmer
5878.14 In reply to 5878.13 
Posted version 2b, with two slight changes. See first post for details.
  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:  bemfarmer
5878.15 In reply to 5878.10 
Hi Michael

Is there some way to get the end point tangent of a curve, by script?
I was thinking of correcting the interpcurve version of a clothoid curve between two existing curves, and to
correct the slight errors in the beginning and ending tangents by doing a MoI Blend between the start point, and the second interpcurve point,
and also a second Blend between the next to last point, and the end point.

Or maybe there should be extra points between the beginning and first point, and also between the next to last point, and the end point?

I have read that for these types of curves, it is not possible to perfectly display the curves by NURBS, but only to within some tolerance?

Also wondered if you will be improving the slide bars for scripts, as the sliders that you do for your factory commands work so much better?

Thank you

-Brian
  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
5878.16 In reply to 5878.15 
Hi Brian,

> Is there some way to get the end point tangent of a curve, by script?

Sorry no there is not currently any curve tangent evaluation set up for script access.


> I have read that for these types of curves, it is not possible to perfectly display the
> curves by NURBS, but only to within some tolerance?

Yeah that's pretty common, usually any specific kind of curve can't be 100% exactly represented by a different kind of curve but can be approximated using a bunch of points to some tolerance level.

NURBS curves can exactly represent conic section curves though.


> Also wondered if you will be improving the slide bars for scripts, as the sliders
> that you do for your factory commands work so much better?

Probably what you're running into here is that the script is running in a separate process so every call that it makes into MoI has to do some inter-process communication. But it's also why a command script can't easily crash MoI, because the separate process that the script is running in can be just torn down without really needing any cooperation from the script itself.

One thing you could try is to put more of the logic into a <script> tag inside the .htm file - that will run inside of the main moi process and won't have to do any inter-process communication when it makes calls into moi.

- 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:  bemfarmer
5878.17 In reply to 5878.16 
Michael, thank you very much.
I'll have to learn more about how *.htm files work, and how they work with MoI.

-Brian
  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
5878.18 In reply to 5878.17 
Hi Brian, *.htm files for commands in MoI are the same as HTML files that are displayed in web browsers, the upper-right area of MoI's main window basically has an embedded web browser there that loads the HTML content. You can also have script in that HTML content same as you can in HTML files that are displayed in a regular web browser. There are a few different ways that scripts can be declared on a web page, it's possible to have an event handler declared in something like an onclick="" attribute on a button but if you have some pretty big functions it's more typical to have those functions declared in a <script> block that you put in the <head> portion of the HTML page.

The command script (the .js file part of a command) can call script functions that are in the HTML page, the root object of the HTML page is available under moi.ui.commandUI , and any script functions declared on that page end up as global variables there, so if you have a function in HTML called blah() like this:

code:
    <html>
        <head>
              <script>
                  function blah()
                  {
                      .....
                  }
               </script>
        </head>
     
      .......



That function defined in the HTML file can be called from the .js file by: moi.ui.commandUI.blah();


I've attached an example where I've edited your Clothoid2ptDraft2b command to move a bunch of the script construction logic over into the HTML file which is then called in this manner from the .js file.


The script code that is declared inside of the HTML file will have fairly different performance characteristics than the code that's run in the .js file - that's because the HTML page runs directly inside of the main MoI.exe process, while a regular command's script file runs in a separate process: moi_commandprocessor.exe and it talks to MoI.exe whenever you make calls into any MoI object. The main reason for this inter-process communication is to make it harder for scripts to be able to crash or lock up MoI, with the script being in a different process it's a lot easier for MoI to forcibly terminate that script at any time without anything happening to the main moi.exe process.

Script code that you run directly inside of the main MoI process will have less overhead to each MoI object call that's done in it, but it will also be easier for the script to lock things up if it goes into a tight loop or things like that as well.


In the future I'd like to make a type of "script factory" mechanism that would make it possible to write some script that would run in a separate worker process but have in-process calls for geometry access and vector math type functions so that the script would not have as much overhead.

The way regular MoI commands are set up though the scripts are mostly used for control flow logic and not for doing heavy duty calculations directly in a script - heavy calculations happen in the geometry factories that are currently written in C++ and they have that kind of direct geometry access even though they run in a separate worker because any geometry that's being used by the factory is sent over to the worker process so that it can then access it locally as it does calculations on it.


So anyway basically right now things are not really optimized for the case of doing heavy calculations directly in script, but you may get some lower overhead for scripts that are contained inside of the HTML part of the command which is normally where the UI controls go. You can have script code in there as well though if you want by using <script> tags. Hope this explains a bit more of how things are currently set up to work.


- 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:  bemfarmer
5878.19 In reply to 5878.18 
Michael, thank you very much for these details.
I'll study them after work...(I've been to busy to do much lately.)

There is a new paper called "Super Space Clothoids," which are 3D, but the math is very difficult.
http://hal.inria.fr/docs/00/84/03/35/PDF/eulerspiral.pdf

-Brian

EDITED: 9 Jul 2013 by BEMFARMER

  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:  Frenchy Pilou (PILOU)
5878.20 In reply to 5878.19 
Made in France! :)
---
Pilou
Is beautiful that please without concept!
My Gallery
  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:  Mauro (M-DYNAMICS)
5878.21 In reply to 5878.20 
..French Pride.. ;) :)
  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:  bemfarmer
5878.22 In reply to 5878.20 
Oui :-)
  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:  bemfarmer
5878.23 
After a long hiatus, spent a few hours adding two sliders for the start and end angles of the clothoid.
It only took a few minutes to add the sliders, but a lot longer to get everything working more or less properly,
due to limited programming skills and limited understanding.
Much of the code is in the htm file, as per Michaels post.

The MoI3 version of Blend command was used for the basic pattern, but had to modify it per Michaels help of many months ago, since
the sliders do not have a "clothoid factory" to work with. The sliders work "better" in Blend command, (in my opinion).

Is there some way to make the clothoid sliders update interactively, not just when the mouse button is released?

Angles can also be typed into the boxes.

The MoI3 version does not quite work in MoI2. MoI2 hangs up for awhile, but then permits exit from MoI2.
The MoI2 version of Blend appears to have a different line in the slider code.
Including this difference allowed a version that works in MoI2, and it also worked in MoI3.

Attached a MoI3 version, and also a MoI2 version, both with limited testing

Edit August 2, 2013...See August2 post for updated onmousemovevaluechange sliders for MoI3August1Beta.

EDITED: 3 Aug 2013 by BEMFARMER


  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
5878.24 In reply to 5878.23 
Hi Brian,

> Is there some way to make the clothoid sliders update interactively, not just when the mouse button is released?

I'm sorry there's not any way to do that currently, at the moment the interactive slider stuff is only set to work through the property binding mechanism so it will only work for binding to a geometry factory input, not to trigger a script event for the interactive movement.

I'll see about putting in an option for the slider for generating continuous events for every mouse move.

- 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:  bemfarmer
5878.25 In reply to 5878.24 
Hi Michael,

Thank you.

- Brian
  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
5878.26 In reply to 5878.25 
Hi Brian, for the next v3 beta I've updated the slider control so it will fire an onmousemovevaluechange="...." script event for every mouse move, so you'll be able to put in a script handler for that event instead of just onvaluechange="" if you want to get more interactive events.

- 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:  bemfarmer
5878.27 In reply to 5878.26 
Thank you Michael.

I wonder if it will be useful for anything else...?

-Brian
  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:  bemfarmer
5878.28 In reply to 5878.26 
Attached improved onmousemove sliders for interactively adjusting clothoid start and end angles by slider, for MoI3BetaAugust1_2013.

Thanks to Michael for updating slider control.

-Brian

Edit: See next post for script files with big sliders

EDITED: 5 Aug 2013 by BEMFARMER

  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:  bemfarmer
5878.29 In reply to 5878.28 
Studied a bit of HTML code, and updated the htm file to display Big sliders.
Noticed a bit of brief shakiness of the curves.
-Brian
ps Discovered a re-write of the source paper at http://arxiv.org/pdf/1305.6644.pdf.
Have to study it to see if the Math is any more comprehensible.

EDITED: 5 Aug 2013 by BEMFARMER


  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:  Frenchy Pilou (PILOU)
5878.30 
here maybe for the yellow curve that is 30° & 90°
(a Clothoïd curve is slightly different than a Blend curve or Conic curve)

But does it possible to have directly the optimum result (yellow) without the sliders ?






Ps Have you a site where are all your Moi Scripts ?

EDITED: 14 Oct 2013 by PILOU

  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:  bemfarmer
5878.31 In reply to 5878.30 
Hi Pilou,

The problem is with getting and preserving the tangents at the beginning and end.
I am unable to extract the two tangents by clicking on the curve(s), using scripts.
(This is do-able using Nurbs equations, for an expert, for example the blend command.)
So instead, helper tangent lines are used.
A few months ago I did a script to utilize two helper line segments, at the beginning and end, which are
placed manually, as tangents. However, using the interpcurve or curve factories, to draw the clothoid, resulted
in a clothoid curve which were close to being tangent, but were not quite tangent, so the code was never polished up.
I may revisit it sometime. I do not want to post "sloppy" code, and try to polish it up, at least somewhat...

When I am tracing curve drawings using an image, Blend often works well. Sometimes a clothoid is very helpful, used to
help establish a curve, which blend can alter.

(Note that the factory curves are close approximations to such curves as clothoids, catenaries, sinewaves, etc.)

- Brian

Edit: I have not made a website yet :-)
  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:  Frenchy Pilou (PILOU)
5878.32 In reply to 5878.31 
thx for the infos!
---
Pilou
Is beautiful that please without concept!
My Gallery
  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-12  13-32  33-35