Need help testing vector separation.

In summary, the conversation discusses the problem of determining if there is a perpendicular axis that separates two vectors facing towards each other. The suggested solution is to construct a line perpendicular to the first vector and calculate the distance between this line and the origin of the second vector. If the distance is less than the length of the second vector, a separating axis can be constructed. The conversation also mentions using a pre-existing method for calculating the distance.
  • #1
marklee42
3
0
I'm writing code to check if polygons intersect, but I've ran into a problem.

I have two "vectors." Each has an origin and x and y components. They are facing towards each other. I need to write code that determines if there's a perpendicular axis that separates them. Here's a picture of what I mean:

http://upurs.us/image/15257.jpeg

I'm out of ideas. Any help would be greatly appreciated.
 
Mathematics news on Phys.org
  • #2
Are the vectors perpendicular? Your question suggests that they are but your coordinates do not make that clear. (In particular, if the labels and my math are correct, they are perpendicular iff y=a.)
 
  • #3
Hint: If you constructed an infinite line that was perpendicular to the first vector and went through (x+a,y+a) of your first vector and then you ignore your first vector... now can you think of something useful to do to make progress towards your solution? See if you can figure it out from that hint before someone gives the answer away.
 
  • #4
My diagram was ambiguous on the point labels, here's what I meant:

http://upurs.us/image/15271.jpeg

I also drew the line I think Bill Simpson was referring to. My guess is that I just need to check these lines for intersection. If so, I have further questions:

a) http://en.wikipedia.org/wiki/Line_segment_intersection" is a bit out of my scope, and I'm not sure how this would work in code. In particular, I can't tell the computer to use substitution. Is there an equation that works given the endpoints?

b) The line can't be infinite length, but since I'm testing collision, it would work fine with an arbitrary value larger than the polygon.
 
Last edited by a moderator:
  • #5
As Bill Simpson told you, you construct the line that is perpendicular to the first vector and that goes through (x+a,y+b).
After that, you can forget your first vector and concentrate on to calculate the distance between this line and the origin of your second vector.
If this distance is lower than the length of the second vector, then it is possible to construct a separating axis (in fact, infinite of them).
If the distance is greater or equal than the length of the second vector, then it is not possible to construct a separating axis.
I hope this can help you.
 
  • #6
Following your diagram, you must calculate the distance between the green line (L) and the point (x2,y2).
The green line is a separating axis iff

distance [L,(x2,y2)] < sqrt[(x2-a2)^2+(y2-b2)^2]
 
  • #7
Testing for distance and comparing to the length of the second vector makes sense. Turns out there's already a method that takes care of calculating the distance, so I shouldn't have any problems.

Thanks for the help!
 

FAQ: Need help testing vector separation.

What is vector separation testing?

Vector separation testing is a scientific method used to separate and analyze the physical and chemical properties of different types of vectors, such as DNA or RNA. It involves using various techniques and technologies to isolate and purify specific vectors from a complex mixture.

Why is vector separation testing important?

Vector separation testing is important because it allows scientists to study and understand the characteristics and functions of different vectors. This information is crucial for many fields of research, including genetics, biotechnology, and medicine.

How is vector separation testing performed?

Vector separation testing is performed using a variety of techniques, including centrifugation, gel electrophoresis, chromatography, and PCR (polymerase chain reaction). These methods rely on the physical and chemical characteristics of the vectors to separate them from other components in a sample.

What are some applications of vector separation testing?

Vector separation testing has many applications in scientific research, including cloning, gene sequencing, gene therapy, and drug development. It can also be used in forensics and agriculture to identify and analyze specific vectors.

What are some challenges of vector separation testing?

One of the main challenges of vector separation testing is the complexity of the samples and the need for highly specialized and precise equipment. Additionally, different vectors may have similar characteristics, making it difficult to isolate them from each other. Contamination and low yields are also common challenges in vector separation testing.

Similar threads

Replies
11
Views
2K
Replies
3
Views
1K
Replies
3
Views
2K
Replies
10
Views
2K
Replies
1
Views
2K
Replies
5
Views
2K
Back
Top