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

 From: bemfarmer 31 Aug 2013  (1 of 31)
 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

 From: bemfarmer 31 Aug 2013  (2 of 31)
 Is there a script to locate the END of a curve? - Brian

 From: Michael Gibson 31 Aug 2013  (3 of 31)
 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

 From: bemfarmer 31 Aug 2013  (4 of 31)
 6148.4 In reply to 6148.3 Thank you Michael :-) - Brian

 From: Frenchy Pilou (PILOU) 1 Sep 2013  (5 of 31)
 This can be inside a script for enlight a point at Start/ End of a curve ?

 From: Michael Gibson 1 Sep 2013  (6 of 31)
 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

 From: Frenchy Pilou (PILOU) 1 Sep 2013  (7 of 31)
 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

 From: bemfarmer 1 Sep 2013  (8 of 31)
 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

 From: bemfarmer 1 Sep 2013  (9 of 31)
 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

 From: bemfarmer 4 Sep 2013  (10 of 31)
 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

 From: Michael Gibson 4 Sep 2013  (11 of 31)
 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

 From: bemfarmer 4 Sep 2013  (12 of 31)
 6148.12 In reply to 6148.11 Thank you Michael, I'll post some tomorrow - Brian

 From: bemfarmer 5 Sep 2013  (13 of 31)
 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 Attachments:

 From: bemfarmer 6 Sep 2013  (14 of 31)
 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

 From: Michael Gibson 6 Sep 2013  (15 of 31)
 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

 From: bemfarmer 6 Sep 2013  (16 of 31)
 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

 From: coi (MARCO) 24 Sep 2013  (17 of 31)
 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