Thread: Help: graph my computed output onto my canvas?

1. Help: graph my computed output onto my canvas?

I runned my canvas now with working buttons..

I can compute for them, how can i integrate them into my canvas using drawArc?

how can i define that the circle has this center, has this radius and etc.

i can create a circle using drawArc();

i only have 2days before submission T_T

2. Re: Help: graph my computed output onto my canvas?

Hi,
While you are calculating the center,radius and circumference of the circle by the methods you have designed and developed ..what are the arguments/params you are supposed to passed in..
Thanks,

3. Re: Help: graph my computed output onto my canvas?

gudeve sir Raj..

else if (displayable == frmInputCircleEq1) {
if (command == okCommand1) {
//Compute
circumference = 2*pi*r;
circleArea = pi*r*r;
getDisplay().setCurrent(get_frmOutputCircleEq1());
// Insert post-action code here
//Output
frmOutputCircleEq1.deleteAll();
frmOutputCircleEq1.append("Center: (0,0)\n");
frmOutputCircleEq1.append("Circumference: " + circumference + "\n");
frmOutputCircleEq1.append("Area: " + circleArea + "\n");

that's from my first circle equation the only input is Radius.. the Computed values(to be graphed) are Center/Circumference/Area

basically in that equation center must be 0,0 on my graph...

this is my Cartesian plane:

g.setColor (255,255,255);
g.fillRect (0, 0, getWidth (), getHeight ());

g.setStrokeStyle(Graphics.SOLID);
//Draw X axis
g.setColor(0x00ff00);
g.drawLine(0, height/2, width, height/2);
//Draw Y axis
g.setColor(0x00ff00);
g.drawLine(width/2, 0,width/2 , height);

Thank you.. im just pressure with less time left.. luckily i have been able to run the command buttons by combining my canvas class to my MainMidlet.. so i only have 1 file..

sir Raj, I hope you can help me again..

4. Re: Help: graph my computed output onto my canvas?

Hi chinito15,
you can draw the circle in two ways,
1.drawArc();
2.drawOval()
for the first way -
you can use
g.drawArc(x, y,width, height, startAngle, arcAngle);

x,y,width and height will form a rectangle
you may draw a circle by circling an arc around the rectangle, for example startAngle should be 0 and arcAngle is 360, then you have yourself a circle.

If you prefer a filled arc then use
g.fillArc with the same arguments
For the second way -
g.fillOval(getXPosition(), getYPosition(), getBallDiameter(), getBallDiameter());
Now what is next requirement,
Thanks,

5. Re: Help: graph my computed output onto my canvas?

that's great, sir i used drawArc..

so i can draw a circle anywhere now, but it's no relation to my Computed values..

Can you please give me a formula for integrating Circumference Diameter or Area?

which value will be the width? the height? of the circle?

and if i put x,y as 0,0:: it does not go to the center of my cartesian plane... like for example the circle has 0,0 center ,
a 31 Circumference, and an area of 78.54

my values are not yet connected to my graphCircle..

sorry, Im poor in formulating calculations and formulas

Note: my cartesian canvas does not contain numbers, I just want the user to see that the coordinates are right,the circle growing big if the output is high, or small if output is small, and in the correct center positioning..

thanks a lot sir raj

6. Re: Help: graph my computed output onto my canvas?

sorry, Im poor in formulating calculations and formulas
I dont think ur lacking math skills but more programming knowledge regarding java...

As raj_j2me correctly states U will have to use
g.drawArc(x, y,width, height, startAngle, arcAngle);
method...

Now u just have to use this great thing called google to search the description for that method, or just look for the API's documentation of j2me...
U cant expect from the platform ur working on to do everything for u and thus u will have to learn the possibilities (and limitations) of the chosen platform...

7. Re: Help: graph my computed output onto my canvas?

Hi,
Chinto..provide the answer of these queries -

@ If you have the radius then can you draw the circle...
@ If you have the radius then can you calculate the point of the length 10 ...

Please note that you can do it ..if you will think and search..however give the quick reply this post..
Thanks.

8. Re: Help: graph my computed output onto my canvas?

Hi. i can graph the circle correctly now,

now im onto the ellipse, i can graph it sir, but it is not centered...

g.drawArc(x,y,sqrtA,sqrtB,0,360);

i don't know what to put in x and y to make in appear in the center of my graph..

my graphline is the same it is width and height/2 .. but that doesn't work on my ellipse graph...

please share some ideas so i can center it on my cartesian plane...

9. Re: Help: graph my computed output onto my canvas?

Hi chinto,
Its nice to hear that you have done most of the task,
now im onto the ellipse, i can graph it sir, but it is not centered...
Make sure that if you want to draw something on the middle of the screen then you have to set the x - as the screenwidth/2
and that of the y - as the screenheight/2

I means center of the ellipse must be on the middle of the screen.
Thanks,

10. Re: Help: graph my computed output onto my canvas?

thanks sir, now i have been able to do ellipse and circle.

2last shapes..the hyperbola and parabola

Sir, is the hyperbola possible? because it opens upwards or downards or sideways.. depending on the answer..

if i set drawArc into 180degree angle, it can only show a downward arc.......

my values are SqrtA and SqrtB.. help me obtain a formula sir,

for example input is a=4 b=16..
so the variables will be : SqrtA=2 SqrtB=4

the vertices will be (2,4), (-2,4), (-2,-4), and (2,-4).

as i have in my mind, there will be two DrawArcs, please help me formulate the main coordinates so I can graph the given vertices..

the graph should open Sideways one to the left and one to the right... I think this is the hardest part really..

what are the values needed for the first drawArc?
and for the second drawArc?

is it possible?

thanks sir Raj for helping me out!

11. Re: Help: graph my computed output onto my canvas?

really need help on this, this i tomorrow already T_T

i cant draw a Line or Arc that will look like a hyperbola...

som1 help pls... even if it will look like > < it is ok..

pls help

12. Re: Help: graph my computed output onto my canvas?

hi
what information do you have handy,
Thanks

13. Re: Help: graph my computed output onto my canvas?

it is available sir i post it already it is no. 10 on this thread,,,

i can't draw somethng that will look like > <

so hard? i really need some logic from you now

14. Re: Help: graph my computed output onto my canvas?

Hi Chinto,
Today I am very much busy..can you just read some exercises in order to have the correct information ..
http://jwbales.home.mindspring.com/p...9/part9.3.html
http://home.alltel.net/okrebs/page63.html
http://www.analyzemath.com/EquationH...Hyperbola.html
Thanks,

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•