Jacobi Elliptic Functions, Seiffert Curve script  1-20  21-31

Next
 From:  bemfarmer
6148.1 
Having spent several hours researching, and several more writing the draft script,
I thought I would share the script to create Seiffert spherical curves.
The script works fairly well, but has some bug features, and needs some more work.
The modulus is supposed to be between zero and 1. Provision for a modulus greater than 1 is coded for,
but is forming an ovalshape. It is supposed to be half spherical, I think.
Negative numbers seem to be working, except for a negative number of turns, just have to abs this.
A green sphere is created, but goes away. Need to fix this.
The curve ends up at various locations, which can be manually adjusted by changing the number of turns.
Closed curves would require a transcendental modulus?

Attached is .3dm of a "dog ball toy", quick, apply for patent...:-)
It has modulus of 0.94, and 3.29 turns, and is swept with a circle.

Need to move most of the .js over to the .html side.

There are copious notes in the .js file.

- 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
6148.2 
Is there a script to locate the END of a curve?

- 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
6148.3 In reply to 6148.2 
Hi Brian,

> Is there a script to locate the END of a curve?

If you have a curve, you can get the start or end points by doing:

var startpt = crv.getStartPt();

var endpt = crv.getEndPt();

- 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
6148.4 In reply to 6148.3 
Thank you Michael :-)

- 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:  Frenchy Pilou (PILOU)
6148.5 
This can be inside a script for enlight a point at Start/ End of a curve ?
  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
6148.6 In reply to 6148.5 
Hi Pilou,

> This can be inside a script for enlight a point at Start/ End of a curve ?

Here's one:
http://moi3d.com/forum/index.php?webtag=MOI&msg=5288.21

- 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:  Frenchy Pilou (PILOU)
6148.7 In reply to 6148.6 
Cool!
I call the plug
Then I call Flip and recall again the markcurvestart
Flip Again
So i obtain a Start and End points for the curve! ;)

EDITED: 1 Sep 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
6148.8 In reply to 6148.7 
Thank you PILOU.
I did not know that Flip did that!

I'll try to add both end points inside the switch, updateable, with Michaels information. Should be easy?
Also a checkbox for the sphere.

-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
6148.9 
Michael, I think I found a very minor "typo."
Comparing MarkCurveStart.js with MarkOpenCurveStart.js in Notepad++,
I noticed that the function name inside MarkCurveStart.js is "function MarkOpenCurveStart()".

Another note: Moved all SeiffertCurve script functions, except for the last .js function, from .js to .htm, as per your prior example with clothoid script.
The script seems to run much faster.
But when the script is open, changing an option caused color change of the sphere, as did subsequent mouse movement between option table and the screen.
Moved "g_style_index = 3;//reset color start index" to Update to correct the problem.

- 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
6148.10 
Hi Michael

Is there any way to pass parameters from the .js file to the .htm file?

The only thing that seems to work is, for example: var curvefactory = moi.ui.commandUI.Update();
which does not have any parameters, but does return something, (object?) for curvefactory.
I've tried arrays, but they don't seem to work either.

I'm on my seventh rewrite try for "Seiffert script," but have not figured out everything yet.

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
6148.11 In reply to 6148.10 
Hi Brian, yeah it should be possible to pass parameters from the .js script into a function in the .htm file.

They are running in different processes though (.htm file runs in moi.exe and the .js script in moi_commandprocessor.exe), and so I guess there could be some complications from that.

Do you have some code set up where you were using arrays being passed that you could post so I could test it?

- 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
6148.12 In reply to 6148.11 
Thank you Michael,
I'll post some tomorrow
- 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
6148.13 
Attached is version 8, the "final" version of SeiffertCurve script, which is FAST and doesn't seem to fail, provided
the values are kept less than a few hundred.

The "rate limiting" code of the curvefactory Update has the code inside of the .htm file, and the result is perhaps 10 times faster
than having all the code in the .js file.

I was unable to pass any parameter or arrays from .js to .htm file, without MoI having exceptions and being very slow.

So getting the endpoints and the unit sphere to Update was harder, but as those two are very short, and could be done fast as subroutine functions
in the .js file, that proved to be the way to do it. Having the end point showing allows the length of the curve to be adjusted, by trial and error.

The modulus k is locked to the range 0.1 to 10.0, or the negative. A negative modulus seems to be a mirror of the curve.
The Length factor, "numturns," is locked to positive, and greater than or equal to 0.1.
The number of points "per turn," is set to be at least 100.

For modulus of 1 or greater, the BoostC++ example was used to adjust the code so as to get a result that is a semi-spherical "hat."
(The prior code had an error, failure to swap cn and dn.)

If nothing else, it was good scripting practice.

- 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
6148.14 In reply to 6148.13 
I'll have to revisit this parameter passing between .js and .html, because looking over Michaels previous
help on the Clothoid script shows 2 points and a cplane being passed successfully from .js to .htm.

So I may have done something else wrong.

- 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
6148.15 In reply to 6148.14 
Hi Brian,

> shows 2 points and a cplane being passed successfully from .js to .htm.

It could be something like objects created by MoI can be accessed between the different processes ok but maybe there's a problem with objects that are created directly by the JavaScript runtime itself like arrays are.

I'm not sure though, I would have thought that should be ok.

Let me know if you get something set up that doesn't work and I'll take a look at it, maybe it's something that needs to be tuned in the script system.

- 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
6148.16 In reply to 6148.15 
Thank you Michael. :-)
I think I'll try putting the point script into the html.
It's kind of nice to start with a script which works, and modify it a little at a time.

- 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:  coi (MARCO)
6148.17 In reply to 6148.16 
Hi Brian!

Sorry to "interrupt" this peaceful scripting thread, but i 've question regarding the adaptation of scripts.
I' ve been fiddling with different L-system environments for an ongoing project..mainly for modelling trees and distribution patterns, but they are such versatile generators for all sort of things.

https://en.wikipedia.org/wiki/L-system

I stumbled over this Javascript based L-System generator..

http://www.plastaq.com/elsy/

that's the underlying script:

http://www.plastaq.com/elsy/js/elsy.js

and was wondering, how much effort it would be(if at all possible) to port something like that to MOI?

Thanks in advance,
Marco

EDITED: 24 Sep 2013 by MARCO

  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)
6148.18 In reply to 6148.17 
Eons software give this for free ;)
http://www.plantfactory-tech.com/download/

I had not tested but pretty sure that there is something like inside somewhere ;)

  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:  coi (MARCO)
6148.19 In reply to 6148.18 
hoi pilou!

i'm more after a versatile but simple generator. some l-system generators do offer dxf export, so it would be possible to get the output into MOI, but i just wondered, as stated in my post, if it might actual be possible to bring this "power" into MOI via scripts.

eon plant factory is a very specific type of software..and quite pricey..there are cheaper alternatives to this.

..some deeper background information on L-systems by the "inventor" Aristid Lindenmayer:

The Algorithmic Beauty of Plants

http://algorithmicbotany.org/papers/#abop

- marco
  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)
6148.20 In reply to 6148.19 
Yep but the link that I have given was also free! ;)
<< Learn the Best 3D Plant Technology on Earth for FREE!
<< The Personal Learning Edition of Plant Factory is a fully functional version of Plant Factory Producer that lets you save your work and never expires.

Yes The L_System is a cool avatar of fractal (Benoit Mandelbrot) who is a cool avatar of Julia (Gaston Julia & Pierre Fatou) who is a cool avatar of...etc
Geometry is Fractal isn't ?
  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-31