Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8232073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:42:33+00:00 2026-06-07T17:42:33+00:00

I am launching a projectile around a sphere. My code moves it in a

  • 0

I am launching a projectile around a sphere. My code moves it in a counterclockwise direction just fine. However, I would like it to move in a clockwise direction instead.

I’m guessing that it’s a matter of tuning my math.

// these are my stepping and incrementing variables

int goose1_egg1_step = 1;
int &r_goose1_egg1_step = goose1_egg1_step;
float goose1_egg1_divider = 17500;

// the starting theta/phi values are: 5 and 5

int goose1_egg1_theta=5;
int goose1_egg1_phi=5;

// the ending theta/phi values are: 7 and 1
// there is a difference of 2 between the start and end theta values
// there is a difference of 4 between the start and end phi values

float goose1_egg1_theta_increment = 2/goose1_egg1_divider;
float goose1_egg1_phi_increment = 4/goose1_egg1_divider;

This is my function that displays the updated coordinates each frame with a sphere:

if (goose1_egg1_step < goose1_egg1_divider)
{
    float goose1_egg1_theta_math = (goose1_egg1_theta+(goose1_egg1_theta_increment* r_goose1_egg1_step))/10.0*M_PI;
    float goose1_egg1_phi_math = (goose1_egg1_phi-(goose1_egg1_phi_increment* r_goose1_egg1_step))/10.0*2*M_PI;
    r_goose1_egg1_x = Radius * sin(goose1_egg1_theta_math) * cos(goose1_egg1_phi_math);
    r_goose1_egg1_y = Radius * sin(goose1_egg1_theta_math) * sin(goose1_egg1_phi_math);
    r_goose1_egg1_z = Radius * cos(goose1_egg1_theta_math); 

    glPushMatrix();
    glTranslatef(r_goose1_egg1_x,r_goose1_egg1_y,r_goose1_egg1_z);
    glColor3f (1.0, 0.0, 0.0);
    glutSolidSphere (0.075,5,5);
    glEnd();
    glPopMatrix();
}

And here is how I increment the step value:

if (r_goose1_egg1_step < goose1_egg1_divider)       
{
    ++(r_goose1_egg1_step);
}    
else
    r_goose1_egg1_step=1;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:42:34+00:00Added an answer on June 7, 2026 at 5:42 pm

    Even though you are talking about “clockwise motion” in a sphere, when it only makes sense to me in a plane, it seems to me that what you want could be done just by changing the signals in the two lines where you create goose1_egg1_theta_math and goose1_egg1_phi_math, like this:

        float goose1_egg1_theta_math = (goose1_egg1_theta-(goose1_egg1_theta_increment* r_goose1_egg1_step))/10.0*M_PI;
        float goose1_egg1_phi_math = (goose1_egg1_phi+(goose1_egg1_phi_increment* r_goose1_egg1_step))/10.0*2*M_PI;
    

    This should reverse the way you increment you spherical coordinates, giving you the “counter-clockwise” motion you’re looking for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

GPS is not launching at first run after clicking OK of Would like to
I'm launching an activity and would like to pass a Date(Time) value to it.
After launching listener by the following code is working fine. LocationManager locationManager =(LocationManager) getSystemService(Context.LOCATION_SERVICE);
Launching code on document ready is a pillar of jQuery. But sometimes, lengthy operations
I'm launching a MFMailComposeViewController like so: ShareViewController *shareView = [[ShareViewController alloc] initWithSubject:subject body:body footer:footer];
when launching the following code in ADL, why does the square continue to rotate?
I'm launching the email program in Android from my app, using the following code...
I mean without launching MC. Like vi somefile, but in MC editor.
Background: We are launching a event which would be attended by students from various
My app works fine when launching from XCode, and it starts back up from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.