C How to calculate whether two regions intersect

Updated on technology 2024-04-01
11 answers
  1. Anonymous users2024-02-07

    Both regions should have x and y coordinates, right? It is enough to determine whether the upper left point and the lower left point of the second area are in the first area, if they are, it means that there is anxiety, if not, there is no intersection.

  2. Anonymous users2024-02-06

    For example, xb > xa, and rectangle a is on the left side of rectangle b, then use the rightmost line of a to compare the leftmost line of b, and if there is an intersection point, it means that the rectangle has intersected (so that only one line intersects!). You can also take the center point as the center of the circle, and take the farthest point as the radius, and compare whether the two are too far apart, and if they are too far away, they don't even need to intersect, and it is more practical to call them repeatedly).

    The above edge should be compared to the long side (the edge of the point farther away).

  3. Anonymous users2024-02-05

    Do you have to write** Don't want to write.

    Four points make a b c d

    First, find the one with a small distance from a and b to the straight line cd, let it be l, or judge the angle and use the slope to find one

    Just judge which is bigger, L and D(1+Sin), L is big and doesn't intersect, it's not a waste of time to have an open root (find the distance), and it's not difficult to write a tan sin.

  4. Anonymous users2024-02-04

    It is conceivable to hold the center of the rectangle and rotate it, and in the most extreme case, the two rectangles are exactly half the sum of their diagonal distances.

  5. Anonymous users2024-02-03

    Separate each edge of rectangles A and B. Determine whether the two rectangles intersect by looking at whether the 4 sides of A and the 4 sides of B intersect.

  6. Anonymous users2024-02-02

    See if it helps you.

  7. Anonymous users2024-02-01

    This uses vectors as containers.

    Then compare it yourself with a loop.

    It is a good topic for exercising basic procedural skills.

  8. Anonymous users2024-01-31

    Find out the same content to generate a linked list and put it in head1.

    Let's assume that head1 and head2 are already sorted by data.

    If the data of head1 is smaller than that of head2, the linked list of head1 deletes the node and points to the next node for comparison.

    If the data of head1 is greater than that of head2, the linked list of head2 points to the next node and the comparison continues.

    If the data of the two nodes is the same, keep the node of head1 (find out the same content), head1, and head2 all point to the next node and continue to compare.

  9. Anonymous users2024-01-30

    The data structure C language version, look at the numerical position.

  10. Anonymous users2024-01-29

    A similar linked list algorithm. Sorted, isn't it?

  11. Anonymous users2024-01-28

    Hello, the specific data type is not given in the question, so the following is given pseudo** as an idea.

    If you know the specific data type, there may be an off-the-shelf solution in the C++ library) class a as a collection element.

    class b as a collection.

    Method b2} that returns a union with another set

Related questions
8 answers2024-04-01

Divide the computer desktop into several areas and put different icons, which can be achieved with the "Fence Desktop" software, and the specific operation is as follows: >>>More

4 answers2024-04-01

define the function void f(int q, int w, int e=0);

e=0 is the default argument, when the function is called f(1,2), then e=0 >>>More

19 answers2024-04-01

Write in the click of button1; Then write using system in the main function; >>>More

9 answers2024-04-01

The original meaning of the question is to implement the function of one queue with two stacks. >>>More

5 answers2024-04-01

int max(float fx,float fy)float fz;

fz=fx>fy?fx:fy; >>>More