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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:34:25+00:00 2026-06-14T17:34:25+00:00

Could anyone share with me why I am getting this error? Basically it’s a

  • 0

Could anyone share with me why I am getting this error? Basically it’s a program where I want to simulate basic basic plant growth. I want to do it in such a way that the petals are all stored in an array of circles.

Stem myStem;
Circle circles;

float scaleFactor=0.5;

void setup() {
  size(floor(400*scaleFactor), floor(800*scaleFactor));
  myStem = new Stem(200,800);

}

void draw() {

  background(150);
  smooth();
  Circle circles[];
  circles = new Circle[5];
  circles[0]  = new Circle(0, -40, 50, 50);
  circles[1]  = new Circle(0, -40, 50, 50);
  circles[2]  = new Circle(0, -40, 50, 50);
  circles[3]  = new Circle(0, -40, 50, 50);
  circles[4]  = new Circle(0, -40, 50, 50);

  for (int i = 0; i < circles.length; i++) {
   circles = ellipse(circles[i].c1, circles[i].c2, circles[i].c3, circles[i].c4);
   rotate(radians(72));
   circles[i] = Circle;
  }

  myStem.drawStem();

}

class Stem { 
  int initalloX=200;
  int initalloY=800;

  Stem(int tempInitalloX, int tempInitalloY) {
    initalloX = tempInitalloX;
    initalloY = tempInitalloY;

  }

  void drawStem() {
    background(#0DBADB);
    scale(scaleFactor, scaleFactor);
    stroke (12, 149, 11);
    fill (12, 149, 11);
    strokeWeight(10);
    line(initalloX, initalloY, initalloX, ((frameCount>250)?initalloY-500:initalloY-(2*frameCount)));
    //stem1
    if (frameCount>101) {
      noStroke();
      translate(initalloX, initalloY-200);
      scale(min((float)(frameCount-100)/100, 1), min((float)(frameCount-100)/100, 1));
      beginShape();
      vertex(0, 0);
      bezierVertex(-40, -5, -30, -40, -80, -20);
      bezierVertex(-47, -16, -52, 8, 0, 0);
      endShape(CLOSE);
      scale(1/min((float)(frameCount-100)/100, 1), 1/min((float)(frameCount-100)/100, 1));
      translate(-initalloX, -(initalloY-200));
    }
    //stem2
    if (frameCount>151) {
      noStroke();
      translate(initalloX, initalloY-300);
      scale(-min((float)(frameCount-150)/150, 1), min((float)(frameCount-150)/150, 1));
      beginShape();
      vertex(0, 0);
      bezierVertex(-40, -5, -30, -40, -80, -20);
      bezierVertex(-47, -16, -52, 8, 0, 0);
      endShape(CLOSE);
      scale(-1/min((float)(frameCount-150)/150, 1), 1/min((float)(frameCount-150)/150, 1));
      translate(-initalloX, -(initalloY-300));
    }
  }
}

class Circle {

  int c1 = 0;
  int c2 = -40;
  int c3 = 50;
  int c4 = 50;

  Circle(int tc1, int tc2, int tc3, int tc4) {
    c1 = tc1;
    c2 = tc2;
    c3 = tc3;
    c4 = tc4;
  }
 }

Thanks in advance… All help is much appreciated.

  • 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-14T17:34:26+00:00Added an answer on June 14, 2026 at 5:34 pm

    Besides all thing already pointed, note that ellipse() is a void method, and so, it won’t return anything. Thus a line like
    circle = ellipse(x,y,z,z)
    has no meaning. You probably wan to use the values stored in ciclcle[i] to draw ellipses, so just call
    ellipse(circles[i].c1, circles[i].c2, circles[i].c3, circles[i].c4);
    no need for assigning it. Also i don’t see why create 5 equal circles. If your circle object is just storing data, why store the same data five times? The call:

    for (int i = 0; i < circles.length; i++) {
    ellipse(0, -40, 50, 50);
    rotate(radians(72));
    }
    

    Will have the same effect.

    Besides that calling background() at the end of draw (trough myStem.drawStem()) will hide all things previously drawn.
    And yet there is no need to recreate the array and reassign the values 60 times per second, you can move it to setup.

    I made those changes to your code. It will compile now. Still the “petals” is beeing drawn at origin, and the fill/stroke of them needs to be handled, but at least it is running 🙂
    You may want to make a display method in your circle class… More like i pointed in the other post you made. cheers!

    Stem myStem;
    
    //Circle circles; // double declaration
      Circle circles[]; // keeping the array one only
    
    float scaleFactor=0.5;
    
    void setup() {
      size(floor(400*scaleFactor), floor(800*scaleFactor));
      myStem = new Stem(200,800);
    
      //mpoved this to setup, no need to recreate each frame
      circles = new Circle[5];
      circles[0]  = new Circle(0, -40, 50, 50);
      circles[1]  = new Circle(0, -40, 50, 50);
      circles[2]  = new Circle(0, -40, 50, 50);
      circles[3]  = new Circle(0, -40, 50, 50);
      circles[4]  = new Circle(0, -40, 50, 50);
      // also smooth only needs to be called once
      // unless ther is a noSmooth() somewhere
      smooth();
    
    }
    
    void draw() {
    
      // moved this here
      background(#0DBADB);
    
      for (int i = 0; i < circles.length; i++) {
       ellipse(circles[i].c1, circles[i].c2, circles[i].c3, circles[i].c4);
       // note you may use this instead
       //ellipse(0, -40, 50, 50);
       rotate(radians(72));
      }
    
      myStem.drawStem();
    
    
    }
    
    
    
    class Stem { 
      int initalloX=200;
      int initalloY=800;
    
      Stem(int tempInitalloX, int tempInitalloY) {
        initalloX = tempInitalloX;
        initalloY = tempInitalloY;
    
      }
    
      void drawStem() {
        //background(#0DBADB); // this was hiding all other draws
        scale(scaleFactor, scaleFactor);
        stroke (12, 149, 11);
        fill (12, 149, 11);
        strokeWeight(10);
        line(initalloX, initalloY, initalloX, ((frameCount>250)?initalloY-500:initalloY-(2*frameCount)));
        //stem1
        if (frameCount>101) {
          noStroke();
          translate(initalloX, initalloY-200);
          scale(min((float)(frameCount-100)/100, 1), min((float)(frameCount-100)/100, 1));
          beginShape();
          vertex(0, 0);
          bezierVertex(-40, -5, -30, -40, -80, -20);
          bezierVertex(-47, -16, -52, 8, 0, 0);
          endShape(CLOSE);
          scale(1/min((float)(frameCount-100)/100, 1), 1/min((float)(frameCount-100)/100, 1));
          translate(-initalloX, -(initalloY-200));
        }
        //stem2
        if (frameCount>151) {
          noStroke();
          translate(initalloX, initalloY-300);
          scale(-min((float)(frameCount-150)/150, 1), min((float)(frameCount-150)/150, 1));
          beginShape();
          vertex(0, 0);
          bezierVertex(-40, -5, -30, -40, -80, -20);
          bezierVertex(-47, -16, -52, 8, 0, 0);
          endShape(CLOSE);
          scale(-1/min((float)(frameCount-150)/150, 1), 1/min((float)(frameCount-150)/150, 1));
          translate(-initalloX, -(initalloY-300));
        }
      }
    }
    
    class Circle {
    
      int c1 = 0;
      int c2 = -40;
      int c3 = 50;
      int c4 = 50;
    
      Circle(int tc1, int tc2, int tc3, int tc4) {
        c1 = tc1;
        c2 = tc2;
        c3 = tc3;
        c4 = tc4;
      }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For the below program I'm getting this error message: Thread 2 terminated abnormally: Invalid
Could anyone share some links on how to get started using QPID? I have
Could anyone give me some help with this please? The content needs to appear
Could anyone provide me with the pointers to source code for linux commands such
could anyone assist me with this. I need to compare two beefy xml files
I'm getting this error when trying to add a foreign key contraint: #1005 -
I was wondering if anyone could help clear up this issue I am having.
Could anyone guide me in created a simple app in JS? What the app
Could anyone please let me know if there is a way to programatically determine
Could anyone explain to me in noob way what the difference is betweeen ImageIcon

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.