Clear Filters
Clear Filters

Set a Marker on a rotating sphere (sports ball)

10 views (last 30 days)
I have built a mechanistic model to numerically compute the trajectory of a sports ball. I was able to account for bounce, drag (based on velocity) and lift (based on spin) forces but the ball at every timestep is represented by a point (x,y,z). I can visually force it to appear like a sphere using
h = plot3(z(n),x(n),y(n),'or','MarkerSize',15,'MarkerFaceColor','red')
but it doesn't obviously show any rigid body rotation. I have included the relevant clip where we can alos observe that the ball goes underneath the ground (as I built a sphere around the contact point)
1) I am hoping someone would guide me to accurately represent the rigid body motion.
2) Once I can do that and somehow include a fixed marker on the 3D ball, it would rotate accordingly. My idea is to fix the camera position and orientation. Thus, if the ball is moving downwards infront of the camera, the relative position of marker on 2D image plane also goes down thanks to the varying area exposed to camera. This is an animation I'm hoping to create and would greatly appreciate your inputs.

Answers (1)

Poorna
Poorna on 27 Oct 2023
Hi Vineeth,
I understand that you are looking to depict the rigid body rotation of the ball in your model and plotting the ball as big marker is not achieving the required behaviour.
You can achieve the required rigid body rotation of the ball by modelling the ball as a sphere using the “sphere” function and then use the “surf” plot to plot the sphere.
By utilizing a surf plot to represent the ball, you can easily add a marker on its surface using the "plot3" function. Subsequently, you have the flexibility to adjust the marker's position in relation to the sphere's centre, according to the ball's dynamic motion.
Please refer to the following documentation to know more about “sphere” and “surf” functions:
Hope this Helps!
Best regards,
Poorna.

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!