Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Advice please?: AnalyticCurve variables post and replies

Return to the Advice please?: AnalyticCurve variables thread
Login to post to this thread

Advice please?: AnalyticCurve variables - Jun 23 at 9:48AM
Mark Brand
3 Posts

Hi everybody. I'm trying to plot a 4-point bezier curve with moveable control-points on a DrawingPanel using AnalyticCurve.  All is well as long as my FunctionX and FunctionY are in terms only of t and literals, but I am not able to employ any model variables (which would be tracking the control points I wish to manipulate).  I've tried to employ custom functions instead, but that doesn't work for me either (EjsS_5.3_180211).

Please: can anybody advise on an appropriate approach to the above problem?  I've thought that a custom element might hold the answer, but I'm not able to figure out how to implement that either.  Any pointers to source code dealing with similar issues would be equally welcome.  Thank you sincerely in anticipation.


Replies to Advice please?: AnalyticCurve variables

Re: Advice please?: AnalyticCurve variables - Jun 23 9:57AM
lookang Avatar
lookang
193 Posts

Upload your source.
I can understand what you want better if I see your incomplete source codes.
Thanks.


OSP@SG blog
OSP@SG Digital Library


Re: Re: Advice please?: AnalyticCurve variables - Jun 23 11:31AM
Mark Brand
3 Posts

Thank you for responding.  I've abandoned the idea of using AnalyticCurve for this, and decided to use a Trail instead (solution attached).  A custom function borrowed from https://gist.github.com/atomizer/1049745 implements de Casteljau's algorithm.  Of course I'll be interested to know whether there is a way to do this sort of thing with either AnalyticCurve or Custom drawing elements.

Attached File: ejss_src_test2-2.zip



Re: Re: Re: Advice please?: AnalyticCurve variables - Jun 24 2:13AM
lookang Avatar
lookang
193 Posts

Hi Mark, i read your source. i may not be able to help much with regards to 4 point Bézier curve but i do have a source here with analyticCurve generated from a functionField.

 

You perhaps can tinker the codes here to get slider a and b to be Points on the plottingPanel for a fixed curve fit.

 

http://iwant2study.org/ospsg/index.php/interactive-resources/mathematics/117-pure-mathematics/2-sequences-and-series/2-1-sequences-and-series/732-e-fourier-2


OSP@SG blog
OSP@SG Digital Library


Re: Re: Re: Re: Advice please?: AnalyticCurve variables - Jun 26 11:53PM
Mark Brand
3 Posts

Thank you very much for sharing, lookang.  I'm not finding the time to study your example as rigorously as I'd like to, but I can see that I will learn a lot from this when I do.  For now, the big insight is that your FunctionY-s are referring to functions which return strings.  That hadn't occurred to me, but makes sense.  Thanks again.



The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics