Re: Vector implementation
I'm honestly not sure what your actual question is. You might consider posting an SSCCE that demonstrates exactly what problem you're encountering.
1 Attachment(s)
Re: Vector implementation
Sorry about that. My question really is how do I go about implementing this code within my main and or other classes in order to divide my table into vectors? These vectors will then be used to determine the position of the balls before the next shot is taken. I have attached my code which contains 3 classes. Please ignore the comments as I have to enter them for my project.
Re: Vector implementation
People are pretty wary of downloading zip files like that. An SSCCE should be able to be copied and pasted into our own editors so we can see what you're talking about.
But I would expect you would have to create instances of your Vector class, passing in the appropriate information. Recommended reading: Creating Objects (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
Re: Vector implementation
Quote:
2d vector which I am trying to create.
Can you explain what a two dimensional vector is? Would it be the same as the Java SE Vector class except it would take two index values in place of one? For example:
public E get(int index1, index2)
public boolean add(int index, E e)
Re: Vector implementation
Thanks that's a great document. I understand how to give the initial coordinates but how do you create the size of each square and the amount of squares on the plane? Is this done individually with the add() method? Sorry if this seems like a stupid question but I've never used vectors before so just trying to get my head around it.
Thanks for your help.
Re: Vector implementation
Yes a 2d vector takes to values. The x and y coordinates of an object. As for the similarities of the 2 I can't say as I'm new to vectors myself.
Re: Vector implementation
You definition of vector seems closer to that of a point. The x,y location of something.
Re: Vector implementation
Yeah a point can be used too for my problem but vectors were suggested by my lecturer.
Re: Vector implementation
I guess you can call it whatever you want.
Re: Vector implementation
Re: Vector implementation