Scripting possibilities

fleecy shared this question 9 years ago
Answered

Apologies if this has already been asked but I have spent an hour trying to find an answer 8-)


What I am looking for in Geogebra is a script language where I (and my students) can initially create very simple cartesian drawings. For example, I (trainee maths teacher - secondary) am trying to create a lesson plan for complex 2d shapes which I want to do via a script automation. My first shape is an equilaterial triangle with 3 circles centred on the vertices, non overlapping, and an inset circle cut out of the centre of the triangle. I would like to be able to write a script to do this, something like ... (I have 3 decades of coding experience in everything from Assembler to 5GL)


shapeMyCompoundShape = new {


shapeA = new(triangle (type="Equilateral", side=4)) ; draw triangle

shapeA.position.point(A)=(1,1) ; place triangle


shapeB = new(circle (radius=1)) ; create 3 circles radius 1

shapeC = clone(shapeB)

shapeD = clone(shapeB)


setCircles = new (Set, type="lock") ; the 3 circles in this set are property locked i.e. change one, change all.

setCircles.add (shapeB)

setCircles.add (shapeC)

setCircles.add (shapeD)


shapeB.position (shapeA.position.point(A)) ; centre circle on each of the 3 points

shapeC.position (shapeA.position.point(B))

shapeD.position (shapeA.position.point(C))


len1 = new(scalar, value = tools.getDistance(shapeA.line(AB), shapeA.centre)) ; find perpendicular length from a line to a point

shapeE = new(circle (radius=len1, position=shapeA.centre) ; draw a circle in the middle of the triangle and touch the 3 sides


shapeA.area.infill

shapeB.area.infill ; will also infill shapeC and shapeD as they are locked together

shapeE.area.outfill ; remove area


area1 = this.area ; can work out the compound area itself.


}


Is any/all of this possible? Obviously the script should be linked to the GUI tools and vice versa, so editing the rendered shape can alter the script and vice versa.


If not, can I get involved in the team that would consider this and make it happen? Such capabilities would be invaluable for maths teachers and their students, particularly when enhanced with event driven routines, animations, and smart boards/tablets. I guess what I want is a complete descriptive and executive framework for 2D (and ultimately 3D as well) scripting - not a lot then ;-)


cheers


fleecy

Comments (3)

photo
1

Hi,


Just curious - with 2 decades of secondary maths teaching experience and using GGb for a few years - I can't see why I might need to use scripting, when I can create the shape you describe in the graphics view fairly quickly. When would you see it as useful in the classroom?


K.

photo
1

Of course the author may his/her own reason(s), but here is one I can think of:

I want to give a unique hw to each one of my students, with different angles etc..

photo
© 2023 International GeoGebra Institute