hi every one

" A point in the x-y plane is represented by its x-coordinate and y-coordinate.Design the class Point that can store and process a point in the x-y plane.You should then perform operation on a point, such as shoing the point, setting
the coordinates of the point printing the coordinates of the point,
returning the x-coordinate, and returning the y-coordinate. Also write a test program to test various operatio on a point. "

I have this question and I understand every thing except " showing the point "
How I can do it ? . I didn't study anything about x-y plane or drawing by java !! :rolleyes: :sad:

Recommended Answers

All 7 Replies

Member Avatar for iamthwee

I didn't study anything about x-y plane or drawing by java !! :rolleyes: :sad:

So I guess now is a good time to then. Ha ha.

Ok help me to know more about this . I don't ask u to solve it
just teaching me !!

p.s if u want to help me thank u very much . if u don't please don't reply
and wasting ur time and my time : )

Member Avatar for iamthwee

hi every one

" A point in the x-y plane is represented by its x-coordinate and y-coordinate.Design the class Point that can store and process a point in the x-y plane.You should then perform operation on a point, such as shoing the point, setting
the coordinates of the point printing the coordinates of the point,
returning the x-coordinate, and returning the y-coordinate. Also write a test program to test various operatio on a point. "

I have this question and I understand every thing except " showing the point "
How I can do it ? . I didn't study anything about x-y plane or drawing by java !! :rolleyes: :sad:

First design your class. What attributes do you think it should have. What operations do you want to do with the point? How about translation in the x,y plane, rotation or enlargement?

Next how are you going to show the point in a java window. What features will your GUI support, where will your buttons be positioned?

Get it?

where do you use this x,y coordinate? Is it for vector2D class or anyelse?

if you write more detail about your problem or what do you want to do, I may help you?

If it is coordinate system for vector, you can implement it two point as,

double x = 0.0;
double y = 0.0;

And you do somoething else like dot product, reflect...

Then if you want to print it, you should write its toString method:

public String toString(){
return "[x point : " + x + "]" + "y point : " + y + "]"
}

something like this.

if your question is not about this, please write your question in more detail..

hi every one

" A point in the x-y plane is represented by its x-coordinate and y-coordinate.Design the class Point that can store and process a point in the x-y plane.You should then perform operation on a point, such as shoing the point, setting
the coordinates of the point printing the coordinates of the point,
returning the x-coordinate, and returning the y-coordinate. Also write a test program to test various operatio on a point. "

I have this question and I understand every thing except " showing the point "
How I can do it ? . I didn't study anything about x-y plane or drawing by java !! :rolleyes: :sad:

I guess you have an idea about translation, vectors, coordinate system.

4 months ago, I wrote a BaseGameMachine class to give some movements vehicles. It is nor important what is it. But when I coded it, there is some problem about rotation. I done rotation the vehicle with accelration, velocity, side and head but I saw some people use matrix, linear transformation to do rotation, translation or scaling.

Is it important that to implement rotation of vehicle, we must use matrix transformation? Or is it only consist of easy to calculate. What does it provide?

To rotate :
x : old - x-axis x'= new - x axis
y : old - y-axis y'= new - y axis
heading : head positon of vehicle

x' = heading.x * Math.cos(angle) - heading.y * Math.sin(angle);

y' = heading.x * Math.sin(angle) + heading.y * Math.cos(angle);


If you or anybody have an idea and give me some advice about this, thank you all :)

First design your class. What attributes do you think it should have. What operations do you want to do with the point? How about translation in the x,y plane, rotation or enlargement?

Next how are you going to show the point in a java window. What features will your GUI support, where will your buttons be positioned?

Get it?

Member Avatar for iamthwee

>Is it important that to implement rotation of vehicle, we must use matrix transformation? Or is it only consist of easy to calculate. What does it provide?


Regardless of whether you're doing, 2d or 3d operations you should be using matrices. It just makes the math so much easier.

Now, if you're asking me to explain all that to you, no thank you. There are plenty of tutorials explaining all that crap far better then I ever could.

And in most case you would be using an external library, so in effect you don't even have to deal with matrices at all. You just call the function.

matrix_rotate_x_y(x,y)

> Now, if you're asking me to explain all that to you, no thank you. There are plenty of tutorials explaining all that crap far better then I ever could.

What should I use keyword to search this transformations?

I searched with keyword "transformations in 2D" , "matrix vector2D" etc.

What is the exact subject for this subject? Or do you know good tutorial for it? Moreover, I don't use any library, because I don't know any. Only I wrote vector2D for myself and I achieved to move vehicle. Which library can I use? Thank for your answer, it's much appreciated...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.