Skip to main content
Grammar and formatting clarifications. Rearranged for flow. Retagged and retitiled to match content.
Source Link
Anko
  • 13.4k
  • 10
  • 55
  • 82

Elastic Collision Formula How do I find a unit vector of another in Java?

I'm trying to writewriting a Java formula based on this tutorial: 2-D elastic collisions without Trigonometry. I am in the section "Elastic Collisions in 2 Dimensions". InPart of step 1, it mentions "Next, find the unit vector of n, which we will call un. This is done by dividing by the magnitude of n". says:

Next, find the unit vector of n, which we will call un. This is done by dividing by the magnitude of n.

My below code represents the normal vector of 2 objects (I'm using a simple array to represent the normal vector), but I am not really sure what the tutorial means by dividing the magnitude of n to get the un.

                int[] normal = new int[2];
                normal[0] = ball2.x - ball1.x;
                normal[1] = ball2.y - ball1.y;

Can anyone please explainI am unsure what the tutorial means by dividing the magnitude of n to get the un.

What is, and how I un? How can I calculate it with my array in Java array?

Elastic Collision Formula in Java

I'm trying to write a Java formula based on this tutorial: 2-D elastic collisions without Trigonometry. I am in the section "Elastic Collisions in 2 Dimensions". In step 1, it mentions "Next, find the unit vector of n, which we will call un. This is done by dividing by the magnitude of n".

My below code represents the normal vector of 2 objects (I'm using a simple array to represent the normal vector), but I am not really sure what the tutorial means by dividing the magnitude of n to get the un.

                int[] normal = new int[2];
                normal[0] = ball2.x - ball1.x;
                normal[1] = ball2.y - ball1.y;

Can anyone please explain what un is, and how I can calculate it with my array in Java?

How do I find a unit vector of another in Java?

I'm writing a Java formula based on this tutorial: 2-D elastic collisions without Trigonometry. I am in the section "Elastic Collisions in 2 Dimensions". Part of step 1 says:

Next, find the unit vector of n, which we will call un. This is done by dividing by the magnitude of n.

My below code represents the normal vector of 2 objects (I'm using a simple array to represent the normal vector).

int[] normal = new int[2];
normal[0] = ball2.x - ball1.x;
normal[1] = ball2.y - ball1.y;

I am unsure what the tutorial means by dividing the magnitude of n to get the un.

What is un? How can I calculate it with my Java array?

Source Link
Shijima
  • 377
  • 3
  • 14

Elastic Collision Formula in Java

I'm trying to write a Java formula based on this tutorial: 2-D elastic collisions without Trigonometry. I am in the section "Elastic Collisions in 2 Dimensions". In step 1, it mentions "Next, find the unit vector of n, which we will call un. This is done by dividing by the magnitude of n".

My below code represents the normal vector of 2 objects (I'm using a simple array to represent the normal vector), but I am not really sure what the tutorial means by dividing the magnitude of n to get the un.

                int[] normal = new int[2];
                normal[0] = ball2.x - ball1.x;
                normal[1] = ball2.y - ball1.y;

Can anyone please explain what un is, and how I can calculate it with my array in Java?