Simple Geometry

The geometric form of the respective recording points:

Point: general use pair record. pair <int, int> or Node structure

Line: There are three kinds of representation in mathematics, but obviously does not apply for the computer. So that we can record online and orientation vector. This can be determined in a straight line up.

Line: you can record the coordinates of the two points

Circle: center and radius

Polygon: open in a certain order array to record each of the vertices of the polygon.

Triangle two well-known formula:

Sine:

 

 R is the radius of the circumscribed circle triangle.

Law of cosines:

 

 

I. Application of Line

  1.    Determine which side of a line of point Q?
    A: Maybe we will be a bit impossible to start. But if the introduction of the vector, we can be very good to consider this issue. First, we are represented by a straight line direction vector v and a point P, we can define the vector PQ, and then take the fork in the PQ vector and vector V, we can learn from the knowledge of mathematics, 0, on the line if the result is , if positive, then in a straight line, or in a straight line. (Right-hand rule)
  2. To determine whether two line segments intersect?
    A: The positional relationship between the two line segments intersect might, collinear, parallel, non-intersecting.
          a> collinear we can determine whether or not collinear. Analyzing two segments or the direction vector is not the same, and all had the same point.
          b> we can determine the slope of the parallel line segments can be located.
          c> disjoint means that these two segments was too far away (straight line, but this is where the two line segments intersect).
          Analyzing d> intersect, we can use straddle experiment, the contents of the memories in a point, we can determine which side of a line of point Q, we now as two points of the line segment A, B segment respectively is b1, b2 .. We now just determine whether these two endpoints on both sides to straight A's.
  3. ? Seek two lines of intersection coordinates
    A: We imagine if two lines intersect. It is not to constitute the four corners of it? This is while the two diagonal corners if the connection is up, that we can not constitute the four triangles? We now consider a triangle, we have to ask whether the triangle formed by the intersection of it? Recall known conditions, we know the direction vector lines and two lines a little. That is, we know that two and two vertices of a triangle that direction vectors. As shown below:

     

    FIG observed on, we can calculate | aXb | = | a | * | b | * sin (ß), | b * u | = | b | * | u | * sin (θ). Made commercially available:
    T = | U | * SiN ([theta]) / (| A | * SiN (beta])). We can observe that | EB | = | u | / sin (β) * sin (θ) ( Sine available, while sin (180-a) == sin (a))..
    By the T to | EB | long we just need to get their take on a can. So this time the coordinates of the intersection B is not coordinate translation | EB | unit lengths it.

  4. Find the coordinates of the intersection circle and a straight line?
    A: There are three circular and linear positional relationship;
           A> from the phase, i.e., greater than the straight line distance to the center of the radius;
           B> tangential, i.e. the distance equal to the radius to the center line; then we can do through the center line A known vertical linear, because the vertical, it can be obtained according to the direction vector. Whereby the problem is transformed into two straight lines to find the intersections.
           c> intersection, using the Pythagorean theorem can be obtained chord midpoint coordinates, the coordinates of intersection is the midpoint coordinate translation half chord length.

Second, the application of the polygon

  1. How to determine a point inside and outside the polygon?
    A: the point with a ray, and if the point of intersection of the odd-numbered polygon is on the inside, the outside is an even number.
  2. How to find the area of a polygon?
    A: The application is the vector cross product. We make an auxiliary point Q, point Q vector of the polygon vertices we can get.
    Then recall the definition of the cross product, we can put polygon area formula:

     

     

Guess you like

Origin www.cnblogs.com/yrz001030/p/12339998.html