Thread: Creating a Mathematical Curve in Java

1. Member
Join Date
Jan 2013
Posts
2
Rep Power
0

Creating a Mathematical Curve in Java

Hey I am having a problem of creating a Mathematical Curve that fits the sin(2x) or cos(2x) on a x and y axis regardless if it was negative or positive value. If it is possible or feasible may somebody help me out, I would deeply appreciate it.

2. Re: Creating a Mathematical Curve in Java

Please go through the Forum Rules, particularly the second paragraph. I've merged the thread you started in New to Java here.

db
Last edited by DarrylBurke; 01-16-2013 at 09:04 AM.

3. Re: Creating a Mathematical Curve in Java

Originally Posted by Zie_Mordecai
Hey I am having a problem of creating a Mathematical Curve that fits the sin(2x) or cos(2x) on a x and y axis regardless if it was negative or positive value. If it is possible or feasible may somebody help me out, I would deeply appreciate it.
To get help, you need to show what you've tried and explain how it doesn't meet your need, then ask a specific question. As it stands, this post looks like 'here's my assignment, someone please do it for me' -- and that isn't going to happen.

Are you familiar with the java.lang.Math class? Do you know how to perform custom painting? Have you read up about 2D Graphics?

db

4. Member
Join Date
Jan 2013
Posts
2
Rep Power
0

Re: Creating a Mathematical Curve in Java

I have a book called JAVA 2D Graphics by Jonathan Knudsen. I can create the frames, however making the x and y axis is somewhat misleading. Here is what I did,

public static void main(String[] args) {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(400,400);
f.setLocation(200,200);
f.setVisible(true);
}
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;

}

That's how far I got.
Can you help me out please.

5. Re: Creating a Mathematical Curve in Java

Please go through Guide For New Members and BB Code List - Java Programming Forum - Learn Java Programming and edit your post accordingly.

db

6. Re: Creating a Mathematical Curve in Java

Also, you didn't reply to my 3 simple questions and it's clear that you haven't gone through the painting tutorial. If you're not going to take advice, why ask for it?

db

Posting Permissions

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