# math - Turn one object around another

Page 1 of 1

## 0 Replies - 552 Views - Last Post: 12 April 2021 - 06:34 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=421036&amp;s=76765a6bced2d0129efe40a5e1282505&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 gorana

Reputation: 0
• Posts: 3
• Joined: 06-January 21

# math - Turn one object around another

Posted 12 April 2021 - 06:34 AM

I have two rounds pt1 (0.0f, 0.0f, 0.0f) and pt2 (1.5f, 0.0f, 0.0f). pt2 revolves around pt1. I want to increase the radius relative to the current position pt2. It now moves only half a circle from right to top left then stops.

```case VK_DOWN:
{
Vector3		a	= pt2.pos - pt1.pos,
b( 1.0f, 0.0f, 0.0f );

float	dot		= a.dot( b ),
lenA	= a.length(),
lenB	= b.length(),
rad		= acos( dot / (lenA * lenB) );

float	thetaOne	= (PI * 2.0f) / 45;		// 45 - segments