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 7418083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:49:05+00:00 2026-05-29T07:49:05+00:00

I am trying to make some objects, say 12, to rotate in an ellipse

  • 0

I am trying to make some objects, say 12, to rotate in an ellipse path continuously in Processing. I got a sketch which does rotation in a circle and I want to make it to rotate in a ellipse. I have some pointer from processing forum but the code from the pointer is different from the code that I posted and I couldn’t understand yet (weak in trigonometry).

I googled a bit and found a post trying to achieve this with this algorithm:

You need to define your ellipse with a few parameters:

x, y: center of the ellipse
a, b: semimajor and semiminor axes

If you want to move on the elipses this means that you change the
angle between the major axes and your position on the ellipse. Lets
call this angle alpha.

Your position (X,Y) is:

X = x + (a * Math.cos(alpha));
Y = y + (b * Math.sin(alpha));

In order to move left or right you need to increase/decrease alpha and
then recalculate your position. Source:
http://answers.unity3d.com/questions/27620/move-object-allong-an-ellipsoid-path.html

How do I integrate it into my sketch? Thank you.

Here’s my sketch:

void setup()
{
    size(1024, 768);
    textFont(createFont("Arial", 30));
}

void draw()
{
    background(0);
    stroke(255);

    int cx = 500;
    int cy = 350;
    int r = 300; //radius of the circle
    float t = millis()/4000.0f; //increase to slow down the movement

    ellipse(cx, cy, 5, 5);

    for (int i = 1 ; i <= 12; i++) {
        t = t + 100;
        int x = (int)(cx + r * cos(t));
        int y = (int)(cy + r * sin(t));

        line(cx, cy, x, y);
        textSize(30);
        text(i, x, y);

        if (i == 10) {
            textSize(15);
            text("x: " + x + " y: " + y, x - 50, y - 20);
        }
    }
}
  • 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-05-29T07:49:07+00:00Added an answer on May 29, 2026 at 7:49 am

    Replace

    int r = 300; //radius of the circle
    

    with

    int a = 350; // major axis of ellipse
    int b = 250; // minor axis of ellipse
    

    and replace

    int x = (int)(cx + r * cos(t));
    int y = (int)(cy + r * sin(t));
    

    with

    int x = (int)(cx + a * cos(t));
    int y = (int)(cy + b * sin(t));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make some project in which i want a text box
I am trying to make some edits to a site for a client of
I'm trying to make some input fields that I would like to work like
I'm trying to make some common scopes for models to be sharing, so i
I'm trying to make some text bold using HTML, but I'm struggling to get
I'm trying to make some social share buttons at my site, but the urls
I'm trying to make some communication for my PIC devices and I use UDP
I'm trying to make some kind of top for some game stadistics Table it's
I'm trying to make some utils for using with sqlite databases. For that I
I'm trying to make some sort of delay in the view controllers changing. I

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.