Hi,
I can’t figure out how to plot circles with given radii.
I would like the radius to be given as floats with plots units (not integers).
I try to play with markersize but the display sizes do not correspond to xy units.
Any hints?
Laurent
Hi,
I can’t figure out how to plot circles with given radii.
I would like the radius to be given as floats with plots units (not integers).
I try to play with markersize but the display sizes do not correspond to xy units.
Any hints?
Laurent
There might exist simpler solutions, but parametric curves probably cover your needs
There is an unexported partialcircle function that can also plot a whole circle
Thank you very much !
I came across partialcircle but I though that there might be an obvious solution like an annotation to express the markersize in plot units.
Besides, partialcircle seems to take integer arguments… I will use the parametric function solution.
Thank you, this is more elegant !
That’s very cool. Did you do this using Plots? Is the code available?
Thanx !
Yes it is Plots.
At first I used Makie but we are preparing introductory Julia hands-on sessions and lately we experienced a lot of installation problems (Cairo?) that are difficult to handle on multiple heterogeneous student laptops.
The code is not yet ready for sharing but it is mainly based on Chris Hecker tutorial.
The idea is to illustrates the power of Julia’s type system and multiple dispatch on a funny example. A hierarchy of 2D shapes and a bunch of methods for the contact function.
contact(c1::Circle,c2::Circle)
contact(p1::AbstractPolygon,p2::AbstractPolygon)
contact(p::AbstractPolygon,c::Circle)
The resulting Julia’s code is quite compact and performant and I think it gives a pretty convincing demonstration of Julia’s strength compared to other languages. In particular, for matlab users that may not be very experienced with types.
I still wonder about the best Julian way to handle multiple plotting backends (Makie/Plots) that prevents from depending on both packages (toml).
Are you checking all pairwise collisions, or using one of the acceleration techniques like dividing into cells?
Yes. Keep in mind that it is a Julia lecture material and not a simulation package
For the bigger time step, I use an N² overlap check on bounding boxes. From there, overlapping shapes recursively divide their time steps until true contact is reached. Then (hopefully) binary collisions are computed and velocities updated.This sequential code run rather smoothly up to 300 bodies.
BTW I wonder how python or matlab experts would have implement this kind of code. I guess that recursive binary contact may not be that easy to express efficiently with “vectorized” (not SIMD) style…
Is your code now available?
beautiful
That is so helpful! Thank you.
Take a look at https://lazarusa.github.io/gnuplot-examples/ (any suggestions are welcome, I do have a lot of examples around). I just need to know what the community is looking for. Cheers !
Thanks
How would I plot this shape in 3d? Imagine a circular plane
Kind regards
Did you ever finish this code well enough to release it?