If I have a point, p_3 say, is there any way of accessing its x and y coordinates?
The best thing would be if you define p_3 in terms of the coordinates (a, b) within the graph.
Then you could extract the numbers a and b from the graph using this.number(“a”) and this.number(“b”) respectively.
(Assuming the CL code is within the graph, otherwise use graph_name.number(“a”) and graph_name.number(“b”)).
You can access the x and y coordinates of any named point:
You’ll have to assign a variable to the coordinates in order to pull it into CL so for simple movable points Bryn’s example works well, but if your point is based on something else in the graph (i.e. a complicated expression) using .x and .y is a great idea.
Thanks. That’s exactly what I was looking for.
And I can pass the point into a function, which is what I was hoping. That will tidy things up immensely.
Thanks Bryn. I was figuring I would need something along those lines eventually, but I haven’t got to the CL bit yet - still figuring out how to build the graph I want.
I had forgotten all about this functionality in the calculator proper (if indeed I ever knew about it; I have a distant memory of some interaction on Twitter but it might have just been asking for the feature of extracting components of a point).