Cartesian grid
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Cartesian grid
I would like to create a cartesian grid ready to draw mathematical functions into it. The scale of the grid must be automatically resized according to the plot. Thank you
Re: Cartesian grid
Well.
How familiar are you with LiveCode?
All that you ask is quite possible, and not even that difficult, but unless you can drive comfortably, you are a ways from being able to make this happen.
You can certainly draw a pair of axes. You can track the location of all aspects of the program, in what might be considered a built-in X-Y construct where various functions will return the location of the mouse, native objects, etc., in cartesian coordinates.
You can draw a line on that plane by evaluating any expression of any order, or plot a function of any kind. You can scale your plane in any way you like.
All that said, how familiar are you with LiveCode? In other words, can you write a simple script that tracks and displays, in real time, the location of the cursor? If so, write back and you will get all the help you need. If not, you must first learn how to program. The lessons and tutorials are required reading. Playing with simple programs that you author on your own are probably more essential, and I can suggest several that will seem simplistic, but you will find are not.
Craig Newman
How familiar are you with LiveCode?
All that you ask is quite possible, and not even that difficult, but unless you can drive comfortably, you are a ways from being able to make this happen.
You can certainly draw a pair of axes. You can track the location of all aspects of the program, in what might be considered a built-in X-Y construct where various functions will return the location of the mouse, native objects, etc., in cartesian coordinates.
You can draw a line on that plane by evaluating any expression of any order, or plot a function of any kind. You can scale your plane in any way you like.
All that said, how familiar are you with LiveCode? In other words, can you write a simple script that tracks and displays, in real time, the location of the cursor? If so, write back and you will get all the help you need. If not, you must first learn how to program. The lessons and tutorials are required reading. Playing with simple programs that you author on your own are probably more essential, and I can suggest several that will seem simplistic, but you will find are not.
Craig Newman
Re: Cartesian grid
Hi Craig, thanks for your quick answer.
I have seen the documentation, but I think it would be usefull for me if anybody can show me an example of code, where I can see:
1.- How to program the cartesian grid, (especially I have the problem in order to write the numbers of the scale on the X, Y axes)
2.- How to resize the scale of the axes if the mathematical function requires it.
Thanks again.
I have seen the documentation, but I think it would be usefull for me if anybody can show me an example of code, where I can see:
1.- How to program the cartesian grid, (especially I have the problem in order to write the numbers of the scale on the X, Y axes)
2.- How to resize the scale of the axes if the mathematical function requires it.
Thanks again.
Re: Cartesian grid
Hi.
I still do not know if you can even make a new stack and place objects on it. Do you know how to attach a script to an object? Can you make a button that, say, when clicked, displays the result of an arithmetic expression? Can you make a button that, when clicked, fills a field with numbers according to a simple arithmetic rule?
To give you a code example when you have no experience at all in knowing how that code "lives" in liveCode will not be useful at all.
So, can you do any of the things I mentioned? Each of them is a first step in what you ask for as a code example. Each is a first step in learning to drive. You cannot reverse that process. LiveCode is wonderfully open and accessible. Its language and tools are a joy to use, and FAR simpler to learn than any other development environment. But there is still quite a bit that you must know, and be adept at. The good news is that you can do quite a lot, and certainly do what you ask for, with only a small fraction of what LC is capable of.
But you have to have a basis to start. This is not a packaged piece of software. When you start a new project, you start with an utterly blank window.
Craig Newman
I still do not know if you can even make a new stack and place objects on it. Do you know how to attach a script to an object? Can you make a button that, say, when clicked, displays the result of an arithmetic expression? Can you make a button that, when clicked, fills a field with numbers according to a simple arithmetic rule?
To give you a code example when you have no experience at all in knowing how that code "lives" in liveCode will not be useful at all.
So, can you do any of the things I mentioned? Each of them is a first step in what you ask for as a code example. Each is a first step in learning to drive. You cannot reverse that process. LiveCode is wonderfully open and accessible. Its language and tools are a joy to use, and FAR simpler to learn than any other development environment. But there is still quite a bit that you must know, and be adept at. The good news is that you can do quite a lot, and certainly do what you ask for, with only a small fraction of what LC is capable of.
But you have to have a basis to start. This is not a packaged piece of software. When you start a new project, you start with an utterly blank window.
Craig Newman
Re: Cartesian grid
Hmmm.
Go to the dictionary. Look up the following:
function (a control structure)
put (a command)
set (a command)
points (a property)
graphic (an object)
Now, do the statements below mean anything to you?:
1- put processFunction(someFunction,someDomain) into computedValues
2- set the points of graphic "yourPolygon" to computedValues
A- where "yourPolygon" is a type of graphic object, and "computedValues" is a variable containing delimited pairs of integers, representing points on the plane (like "100,200"). This function is invoked from some event acting on some object in a stack, and its output is placed into that variable.
B- "processFunction" is a custom function you will write, passing two parameters, "someFunction" and "someDomain".
I suspect you are more than conceptually capable of doing "B". My point is can you do "A"?
This is not a problem in analysis, It is a problem implementing the tools and functionality in LiveCode.
Craig Newman
Go to the dictionary. Look up the following:
function (a control structure)
put (a command)
set (a command)
points (a property)
graphic (an object)
Now, do the statements below mean anything to you?:
1- put processFunction(someFunction,someDomain) into computedValues
2- set the points of graphic "yourPolygon" to computedValues
A- where "yourPolygon" is a type of graphic object, and "computedValues" is a variable containing delimited pairs of integers, representing points on the plane (like "100,200"). This function is invoked from some event acting on some object in a stack, and its output is placed into that variable.
B- "processFunction" is a custom function you will write, passing two parameters, "someFunction" and "someDomain".
I suspect you are more than conceptually capable of doing "B". My point is can you do "A"?
This is not a problem in analysis, It is a problem implementing the tools and functionality in LiveCode.
Craig Newman
Re: Cartesian grid
Yes, you are right, my biggest problem is "A". That is why I would like to see an example.
Thank you for your kindness
Thank you for your kindness
Re: Cartesian grid
Make a new stack. Make a button, a text field and a polygon graphic. Place these objects near the bottom of the stack window.
In the field, write:
100,100
110,95
120,90
130,85
140,70
150,50
160,10
Put this into the button script:
Now click on the button. Change some of the field values, and click again. The values you entered by hand in the field would instead be computed and scaled based on some function you wanted to graph, like "y = 3x + 10", or "y = x^3" or whatever.
All this is just to tease and annoy you, and is deliberately designed to make my earlier points. You cannot just make applications. You have to learn the language and the tools. You can use this as a start, and try to work backwards, I guess.
This is not a teaching forum. It is an all the help you will ever need forum. Those overlap, of course, but you are expected to be a novice, not a complete beginner. So we will answer all your questions, but not provide your stack for you.
Well, sometimes we sort of do that.
Play with this stack. Figure out how to populate that field with your own data. Take the time. Be patient. Get going.
Write back with questions and frustrations, but make your own project.
Craig Newman
In the field, write:
100,100
110,95
120,90
130,85
140,70
150,50
160,10
Put this into the button script:
Code: Select all
on mouseUp
set the points of grc 1 to fld 1
end mouseUp
All this is just to tease and annoy you, and is deliberately designed to make my earlier points. You cannot just make applications. You have to learn the language and the tools. You can use this as a start, and try to work backwards, I guess.
This is not a teaching forum. It is an all the help you will ever need forum. Those overlap, of course, but you are expected to be a novice, not a complete beginner. So we will answer all your questions, but not provide your stack for you.
Well, sometimes we sort of do that.
Play with this stack. Figure out how to populate that field with your own data. Take the time. Be patient. Get going.
Write back with questions and frustrations, but make your own project.
Craig Newman
Re: Cartesian grid
The purpose of this forum is for discussion of how to use Revolution Media. Revolution Media is Runtime Revolution's toolbox addition for creating interactive digital products and software utilities. Just opening up Revolution Media and don't know where to start? Welcome!
truman