Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-8081-120121-160161-

2D Vector bullshit

Name: Anonymous 2008-11-14 6:04

I've got 2 points (ie. X,Y vectors), and I need to find out the angle (degrees°) between them, so I can move an object which is at one of the points towards the other point.

How do I calculate the degrees plz???

Name: Anonymous 2008-11-14 6:10

lrn2math

Name: Anonymous 2008-11-14 6:15

Degrees suck balls anyway, everyone uses radians.

Name: Anonymous 2008-11-14 6:23

HINT: Angular coefficients are given by the quotient y/x, where x is the horizontal coordinate and y is the vertical one.

Next step to you, anon.

Name: Anonymous 2008-11-14 6:54

theta = |arctan(x0) - arctan(x1)|

Name: Anonymous 2008-11-14 7:14

USE THE POWER OF MIGHTY SINE

Name: Anonymous 2008-11-14 7:31

There is no angle "between" two arbitrary points.  There can always be a straight line segment connecting them.

Name: Anonymous 2008-11-14 7:33

>>7
I've got 2 points (ie. X,Y vectors)

You are as dumb as OP, congratulations

Name: Anonymous 2008-11-14 7:36

>>8
fuuuuu

Name: Anonymous 2008-11-14 7:45

USE THE FUCKING DOT PRODUCT

Name: Anonymous 2008-11-14 10:31

USE THE FUCKING CROSS PRODUCT

Name: Anonymous 2008-11-14 10:36

USE THE FUCKING PROJECTION

Name: Anonymous 2008-11-14 10:36

USE THE FUCKING MATRIX MULTIPLY

Name: Anonymous 2008-11-14 10:38

USE THE FUCKING DETERMINANT

Name: Anonymous 2008-11-14 10:39

USE THE FUCKING EIGENVALUES

Name: Anonymous 2008-11-14 10:39

USE THE FUCKING TRANSPOSE

Name: Anonymous 2008-11-14 10:40

USE THE FUCKING ROW REDUCTION

Name: Anonymous 2008-11-14 10:51

USE THE FUCKING TENSOR PRODUCT

Name: Anonymous 2008-11-14 11:09

USE THE FUCKING DIRECTION COSINES

Name: Anonymous 2008-11-14 11:11

USE THE FUCKING addition

Name: Anonymous 2008-11-14 11:19

USE THE FUCKING QUATERNION NORM

Name: Anonymous 2008-11-14 13:30

USE THE FUCKING FORCE LUkE

Name: Anonymous 2008-11-14 14:59

USE THE FUCKING QUADRATIC FORMULA

Name: Anonymous 2008-11-14 16:20


the proper way to do it isa*b=|a||b|cos(YOURFUCKINGANGLEHERE)to move away from vector a in every direction till it equals b

Name: Anonymous 2008-11-14 19:07

USE THE FUCKING FORCED INDENTATION

Name: Anonymous 2008-11-14 19:18

USE THE FUCKING

Name: Anonymous 2008-11-14 20:07

FUCK THE USING

Name: Anonymous 2008-11-14 22:29

THE USING, FUCK

Name: Anonymous 2008-11-14 23:47

STOP USING DRUGS

Name: Anonymous 2008-11-14 23:54

USE THE FUCKING POLAR COORDINATES

Name: Anonymous 2008-11-15 2:01

USE THE FUCKING LAGRANGE POLYNOMINALS

Name: Anonymous 2008-11-15 3:34

USE THE FUCKING HAMILTONIAN

Name: Anonymous 2008-11-15 7:05

USE THE FUCKING GNIKCUF ETH ESU

Name: HMA MEME FAN 2008-11-15 7:27

HAX MY FUCKING ANUS

Name: Anonymous 2008-11-15 8:36

READ THE FUCKING SICP

Name: Anonymous 2008-11-15 8:40

'hax my anus' has never been a meme.

Name: noobular 2008-11-15 11:57

>>7
fuck.  ok so this is some of my codez:


void Object_t::Move()
{
     Accel.x = thrust * cos(DEG2RAD(headingDegs));
     Accel.y = thrust * sin(DEG2RAD(headingDegs));

     Vector += Velocity;
}


This will move the object's position (ie. Object_t.Vector) towards another 2D Vector, and the direction is based on headingDegs.  If headingDegs=0 it will go straight right, if headingDegs=90 it goes 90° from that point (ie. straight down) etc.

I just need to figure out what headingDegs should be based on my current location (Vector) and my target vector.

Name: Anonymous 2008-11-15 12:21

>>10-23,25-27,29-35
same person.

Name: Anonymous 2008-11-15 14:00

Name: Anonymous 2008-11-15 14:03

>>40
same person.

Name: Anonymous 2008-11-15 15:35


void Object_t::Move()
{
     Accel.x = thrust * cos(DEG2RAD(headingDegs)); ?? OMG SO FUCKING OPTIMZIED!!!!!!!!!
     Accel.y = thrust * sin(DEG2RAD(headingDegs));

     Vector += Velocity;
}

Name: Anonymous 2008-11-15 16:17

>>41
I KNOW RIGHT

I also forgot the Velocity += Accel;  line but eh, I only pasted what's necessary.

So how the piss do I calculate the headingDegs?

Name: Anonymous 2008-11-15 19:13

>>31
POLYNOMINALS
lolwat

Name: Anonymous 2008-11-15 19:35

>>42
Here's what you do. Fuck that pansy ass cosine shit.

cos(x) = dot(X, Y)/(length(X)*length(Y))
x = arccos(dot(X, Y)/(length(X)*length(Y)))

There is the angle between the points. Blam. Read SICP.

Name: Anonymous 2008-11-15 19:37

BTW if you dont know what dot and length are:

dot(X, Y) = X[1]*Y[1] + X[2]*Y[2]
length(X) = sqrt(X[1]*X[1] + X[2]*X[2])

Good day.

Name: Anonymous 2008-11-16 9:14

OP here, finally got this shit working, thx guize l00l

Name: noobular 2008-11-17 8:02

WAIT NO

It doesn't work when the target vector is to the left of my current position vector.

/** Move ()
 *
 * Move the object towards its vector.
 *
 */
void Object_t::Move()
{
     Velocity.x = thrust * cos(headingDegs);
     Velocity.y = thrust * sin(headingDegs);

     Vector += Velocity;
}



/** GetDegrees ()
 *
 * Set headingDegs based on Target vector.
 *
 */

void Object_t::GetDegrees()
{
     float dx, dy;

     if (Target.y > Vector.y)
        dy = Target.y - Vector.y;
     else
        dy = Vector.y - Target.y;

     if (Target.x > Vector.x)
        dx = Target.x - Vector.x;
     else
        dx = Vector.x - Target.x;


     headingDegs = atan(dy / dx);
}



If I add this part to the end:

if (Target.x < Vector.x)
   headingDegs -= DEG2RAD(180);


it will work for targets that are left & up, but not left & down.  WHAT DO I DO LOL?

Name: Anonymous 2008-11-17 8:08

>>47
This is why we DONT HELP HIM!!! ;)

Name: fairX the haxxor 2008-11-17 13:07

>>48
;)

Name: Anonymous 2008-11-17 13:36

>>45
amerifag

Name: Anonymous 2008-11-17 15:20

>>50
explain nao

Name: Anonymous 2008-11-18 5:05

get atan2 up all in that ho for the sign of your life

Name: Anonymous 2008-11-18 5:33

>>47
See http://hyperphysics.phy-astr.gsu.edu/Hbase/ttrig.html#c2, that explains the problem and solution quite well.

Name: Anonymous 2008-11-18 8:02

Why the fuck do you want the angle for this?  Just normalize the delta between the two points to the speed you want.

P.S. And you still need 3 points to calculate an angle, saying the "angle between 2 points" is a fucking meaningless statement.

Name: Anonymous 2008-11-18 9:28

>>54
Obviously, he meant the angle between two vectors, dipshit.

Name: Anonymous 2008-11-18 13:17

This problem is trivial given a mathematician.

Name: Anonymous 2008-11-19 1:36

>>56
Not the useless ones I'm working with.

Name: Anonymous 2009-03-06 7:49

Responder client closed ClientSock.

Name: Anonymous 2010-11-26 13:19

Name: Anonymous 2011-02-04 18:00

Name: Anonymous 2013-06-18 19:47

I ARE ANDRU

Name: Anonymous 2013-06-18 19:54

I ARE ANDRU

Name: Anonymous 2013-06-18 20:01

I ARE ANDRU

Name: Anonymous 2013-06-18 20:08

I ARE ANDRU

Name: Anonymous 2013-06-18 20:16

I ARE ANDRU

Name: Anonymous 2013-06-18 20:23

I ARE ANDRU

Name: Anonymous 2013-06-18 20:30

I ARE ANDRU

Name: Anonymous 2013-06-18 20:37

I ARE ANDRU

Name: Anonymous 2013-06-18 20:44

I ARE ANDRU

Name: Anonymous 2013-06-18 20:51

I ARE ANDRU

Name: Anonymous 2013-06-18 20:58

I ARE ANDRU

Name: Anonymous 2013-06-18 21:05

I ARE ANDRU

Name: Anonymous 2013-06-18 21:12

I ARE ANDRU

Name: Anonymous 2013-06-18 21:20

I ARE ANDRU

Name: Anonymous 2013-06-18 21:27

I ARE ANDRU

Name: Anonymous 2013-06-18 21:34

I ARE ANDRU

Name: Anonymous 2013-06-18 21:41

I ARE ANDRU

Name: Anonymous 2013-06-18 21:48

I ARE ANDRU

Name: Anonymous 2013-06-18 21:55

I ARE ANDRU

Name: Anonymous 2013-06-18 22:02

I ARE ANDRU

Name: Anonymous 2013-06-18 22:10

I ARE ANDRU

Name: Anonymous 2013-06-18 22:17

I ARE ANDRU

Name: Anonymous 2013-06-18 22:24

I ARE ANDRU

Name: Anonymous 2013-06-18 22:31

I ARE ANDRU

Name: Anonymous 2013-06-18 22:38

I ARE ANDRU

Name: Anonymous 2013-06-18 22:45

I ARE ANDRU

Name: Anonymous 2013-06-18 22:52

I ARE ANDRU

Name: Anonymous 2013-06-18 22:59

I ARE ANDRU

Name: Anonymous 2013-06-18 23:06

I ARE ANDRU

Name: Anonymous 2013-06-18 23:14

I ARE ANDRU

Name: Anonymous 2013-06-18 23:20

I ARE ANDRU

Name: Anonymous 2013-06-18 23:27

I ARE ANDRU

Name: Anonymous 2013-06-18 23:34

I ARE ANDRU

Name: Anonymous 2013-06-18 23:42

I ARE ANDRU

Name: Anonymous 2013-06-18 23:49

I ARE ANDRU

Name: Anonymous 2013-06-18 23:56

I ARE ANDRU

Name: Anonymous 2013-06-19 0:03

I ARE ANDRU

Name: Anonymous 2013-06-19 0:10

I ARE ANDRU

Name: Anonymous 2013-06-19 0:17

I ARE ANDRU

Name: Anonymous 2013-06-19 0:24

I ARE ANDRU

Name: Anonymous 2013-06-19 0:31

I ARE ANDRU

Name: Anonymous 2013-06-19 0:38

I ARE ANDRU

Name: Anonymous 2013-06-19 0:45

I ARE ANDRU

Name: Anonymous 2013-06-19 0:52

I ARE ANDRU

Name: Anonymous 2013-06-19 0:58

I ARE ANDRU

Name: Anonymous 2013-06-19 1:05

I ARE ANDRU

Name: Anonymous 2013-06-19 1:12

I ARE ANDRU

Name: Anonymous 2013-06-19 1:19

I ARE ANDRU

Name: Anonymous 2013-06-19 1:26

I ARE ANDRU

Name: Anonymous 2013-06-19 1:33

I ARE ANDRU

Name: Anonymous 2013-06-19 1:40

I ARE ANDRU

Name: Anonymous 2013-06-19 1:47

I ARE ANDRU

Name: Anonymous 2013-06-19 1:54

I ARE ANDRU

Name: Anonymous 2013-06-19 2:01

I ARE ANDRU

Name: Anonymous 2013-06-19 2:08

I ARE ANDRU

Name: Anonymous 2013-06-19 2:15

I ARE ANDRU

Name: Anonymous 2013-06-19 2:22

I ARE ANDRU

Name: Anonymous 2013-06-19 2:29

I ARE ANDRU

Name: Anonymous 2013-06-19 2:36

I ARE ANDRU

Name: Anonymous 2013-06-19 2:43

I ARE ANDRU

Name: Anonymous 2013-06-19 2:50

I ARE ANDRU

Name: Anonymous 2013-06-19 2:57

I ARE ANDRU

Name: Anonymous 2013-06-19 3:04

I ARE ANDRU

Name: Anonymous 2013-06-19 3:11

I ARE ANDRU

Name: Anonymous 2013-06-19 3:18

I ARE ANDRU

Name: Anonymous 2013-06-19 3:24

I ARE ANDRU

Name: Anonymous 2013-06-19 3:31

I ARE ANDRU

Name: Anonymous 2013-06-19 3:39

I ARE ANDRU

Name: Anonymous 2013-06-19 3:46

I ARE ANDRU

Name: Anonymous 2013-06-19 3:53

I ARE ANDRU

Name: Anonymous 2013-06-19 4:00

I ARE ANDRU

Name: Anonymous 2013-06-19 4:07

I ARE ANDRU

Name: Anonymous 2013-06-19 4:14

I ARE ANDRU

Name: Anonymous 2013-06-19 4:21

I ARE ANDRU

Name: Anonymous 2013-06-19 4:27

I ARE ANDRU

Name: Anonymous 2013-06-19 4:34

I ARE ANDRU

Name: Anonymous 2013-06-19 4:41

I ARE ANDRU

Name: Anonymous 2013-06-19 4:48

I ARE ANDRU

Name: Anonymous 2013-06-19 4:55

I ARE ANDRU

Name: Anonymous 2013-06-19 5:02

I ARE ANDRU

Name: Anonymous 2013-06-19 5:09

I ARE ANDRU

Name: Anonymous 2013-06-19 5:16

I ARE ANDRU

Name: Anonymous 2013-06-19 5:23

I ARE ANDRU

Name: Anonymous 2013-06-19 5:30

I ARE ANDRU

Name: Anonymous 2013-06-19 5:37

I ARE ANDRU

Name: Anonymous 2013-06-19 5:44

I ARE ANDRU

Name: Anonymous 2013-06-19 5:51

I ARE ANDRU

Name: Anonymous 2013-06-19 5:58

I ARE ANDRU

Name: Anonymous 2013-06-19 6:05

I ARE ANDRU

Name: Anonymous 2013-06-19 6:12

I ARE ANDRU

Name: Anonymous 2013-06-19 6:19

I ARE ANDRU

Name: Anonymous 2013-06-19 6:26

I ARE ANDRU

Name: Anonymous 2013-06-19 6:33

I ARE ANDRU

Name: Anonymous 2013-06-19 6:40

I ARE ANDRU

Name: Anonymous 2013-06-19 6:47

I ARE ANDRU

Name: Anonymous 2013-06-19 6:54

I ARE ANDRU

Name: Anonymous 2013-06-19 7:01

I ARE ANDRU

Name: Anonymous 2013-06-19 7:08

I ARE ANDRU

Name: Anonymous 2013-06-19 7:15

I ARE ANDRU

Name: Anonymous 2013-06-19 7:22

I ARE ANDRU

Don't change these.
Name: Email:
Entire Thread Thread List