Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get midpoint value in OpenGLES in iPhone?

I am new to game development. Currently I am working in simple game application, using GL_Line to draw a line and GL_Triangle strip to draw a (ball)image. Normally ball images are moving from left to right direction. When the user tab on a screen, then the line draw (top to bottom) inside the screen and to touch a ball image. So I tried to get the midpoint values from line and ball image, but i cannot know, how to start this?

like image 946
SampathKumar Avatar asked Dec 03 '25 16:12

SampathKumar


1 Answers

If you have a line that goes from (ax,ay) to (bx, by), the mid-point of the line is just ((ax + bx) / 2.0, (ay + by) / 2.0)).

like image 80
user1118321 Avatar answered Dec 06 '25 06:12

user1118321