Properties
Category
German
Similar Topics
Statistics
Comments
9
Participants
5
Subscribers
30
Votes
1
Views
100
Share
Javascript get radius of a circle?
Answered
Hello,
I build a little interactive applet with some javascript in the update function.
I just want to color a set of circles depending on their radius. I tried getValue("c") which should return a double value, but its only returning NaN. When I use getValueString("c") it returns the circular equation, but this is really bad for comparison.
Is there no way to compare the circles?
Appreciate your help!
moritz
 GeoGebra
 Help
 Partners

Contact us
 Feedback & Questions
 This email address is being protected from spambots. You need JavaScript enabled to view it.
 +43 677 6137 2693
© 2017 International GeoGebra Institute
with
you get center then
Also consider dynamic colors that don't need scripting.
You can add a condition to display a certain colour, depending on the radius of the corresponding circle.
https://wiki.geogebra.org/e...
Try:
but why not direct in the circleobject in properties/extendedOh I didnt noticed the dynamic colors panel. Thanks! :)
But I still miss the possiblity to change color, when I use the condition I only can make the object dissapear, not changing the color, do I miss something?
I also tried the JavaScript Approach rami suggest, but then geogebra freezes for seconds and I did not get updated values each time I change my construction.
Thanks for further help
input in R G B values depending of radius r=radius(<circle>). ie:
Red:cos(r)
Green:abs(sin(r))
Blue:rfloor(r)
opacity:0.5
you can use all functions but better with functions with range [0,1]
Thanks for the fast reply.
Maybe I should elaborate my usecase even more
This is my https://ggbm.at/jYzzf93z construction. What I try to visualize is:
Find the smallest circle of the right small circles = r min and compare it with the circle rg. If rg < rmin colorize rmin green otherwise red. Atm I tweaked this logic for the red circle, using two circles one appears when the other dissapears...
It is not possible to put this complex logic in the small inputfield for dynamic colors.
delete e_1
you have not used dynamics colors. only red/green colors for two circles
see now the colors of d_1
the value true equal than 1, false equal to 0
I'm not sure it's what you are looking for.
Solution with lists and listcommands (see manual) and dynamic color
Note: only one object has a (simple) condition for dynamiccolor
sorry it took me so long! I didn't realize that I could simply use the different conditions in the same dynamic color to get the result I was looking for. Thank you very much for your patience!
Comments have been locked on this page!