2019 summer training camp Day6 Jinhua Computational Geometry

Autistic training Day6

Computational Geometry

Inner product

Inner product inequality:
\ [(A, B) ^ 2 \ Le (A, A) (B, B) \]
where \ ((A, B) \ ) represents \ (A \ B CDOT \) .

(Like crap?)

Cross product

\[ A\times B=|A||B|\sin \theta \]

Dimensional cross product: \ (A \ B = x_1y_2-x_2y_1 Times \) .

Three-dimensional cross product:
\ [A \ Times B = \ left | \ the begin {Matrix} I & J & K \\ Ax of & Ay & Az \\ Bx & By & Bz \ End {Matrix} \ right | \]
cross-product determination linear relation:? ?

Polar angle

atan2(y,x)The return value \ ((- \ PI, \ PI] \) .

If the difference between the larger polar angle can use this to judge otherwise due to accuracy problems may take a cross product. In range \ (10 ^ 9 \) when this function may basically useless.

Rotation

Rotation vector, the direct use of trigonometric formulas can push, can be written in matrix form.

Classic title

Each time there is rotation / translation / scaling operation, a vector Q \ ([l, r] \ ) what will become after the operation.

Direct written in matrix multiplication form and maintain a tree line.

Simpson Points

For quadratic function \ (F (X) \) , there are
\ [\ int_ {x = l } ^ rf (x) \ mathrm dx = \ frac {(rl) (f (l) + f (r) + 4f ((l + r) / 2
))} {6} \] for other functions, can be fitted with a quadratic function.

Projection

Seeking \ (P \) linear \ (P_1P_2 \) projected on the point / points of symmetry.

Directly to the straight line \ (P_1P_2 \) perpendicular to do it, find a cross, gone.

It can be obtained by dot product \ (PP_1 \) in \ (P_1P_2 \) projected length, and may be obtained pedal.

The positional relationship between vector

Dot product directly through a cross product messing gone.

The positional relationship between a straight line, the positional relationship between the line segments are similar.

Line segment intersection

First straight line parallel to the straight line coincident sentence off.

The two segments are then taken out of the end, both sides to see if another line.

(Teacher's method: first judge whether the bounding rectangle intersect, then do straddle experiment)

Line segment intersection

The sentence straight away coincidence, then as a straight line to find the intersections.

The distance between the line

Distance is defined as the distance of the nearest point.

If there is intersection and 0 otherwise become a point to a line segment distance.

Point to the line segment? Dot product of the sentence about the positional relationship between the endpoint and then do directly.

Polygon area

It does not guarantee that the polygon is convex.

Directly on the two-dimensional plane and then pick a point cross product.

Hantotsutsutsumi

Direct cross product is gone.

Sentenced point within the polygon

Ray method we all know, but there are a lot of nausea border situation.

Two ways:

The first: the slope is set to an odd irrational numbers, all the boundary can be skipped most cases.

The second: Imperial rays to the right, all the boundary conditions are sentenced to get away.

boundary:

  1. If the ray and the edge overlap so continue.
  2. If through the \ (AB \) a \ (A \) , and \ (AB \) down, the counter ++.
  3. If through the \ (AB \) a \ (B \) , and \ (AB \) upwards, the counter ++.
  4. If the point it directly back to the edge.

Seeking convex hull

We all?

Seeking convex hull diameter

Rotating stuck.

Request packet on the left area of ​​the projection rays

The relevant point to pull out, is still a convex hull, then you can count area.

Distance from the nearest point on the plane

KD Tree much good

Divide and conquer, and then find the right match left will only have \ (O (1) \) points may occur contribution, so no more.

Relationship round

Phase from the exo, intersect, endo, intron.

The relationship between the center and radius of fucks to.

Intersection of circular and linear

Radius know, know the distance to the center line, so you can get the chord length, then no more.

Find the intersections of

It can be obtained linear equation intersection, then no more.

Of course, the answer can be obtained by the law of cosines solution triangle.

Point to the tangent point of the circle

Known radius, known from, there is known a right angle triangle can then be solution.

Two common tangent circle

First off the sentence containing the endo.

In this case there must be two common tangent, triangular solution a solution.

Similar common tangent.

Find the area of ​​a circle and a polygon cross-

You can have a post into the triangular area and the area of ​​the circle. Notice any triangulation of origin, it can be set to the center.

If three points are so easily inside.

Otherwise, put the line \ (AB \) engage in out of the intersection with the circle, the triangle cut out recursively.

Only recursive constant layer, but better written.

bzoj1043

Direct violence, is obtained for each disc behind the cover disc off its angle interval required intervals and gone.

Angle range of circular intersection may be seeking.

CF932F

Set \ (dp_x \) represents from \ (x \) to jump to the minimum cost of a leaf, DP from the bottom up.

Each request \ (X \) the answer is found when a slope optimization, the convex hull tree within the heuristic combined together handle gone.

DSU on tree convex hull may be maintained.

Then it is to support the bag to insert a convex point fucks to get set.

A title

Discovery choose up to four vectors, and selected four vectors of time can only be perpendicular to each other, we can rule out. So long as the three vectors is selected, such that the angle between two neighboring vector is less than 180.

Then all the vectors together into reverse, the forward is set to red, green to reverse.

So we are looking form three vectors such as "red-green-red", and the angle between two vectors is less than 180 red.

Enumeration first red vector, the data structure of the last two minimum maintenance.

CF1025F

Conclusion: equivalent to the triangle does not intersect can make two common tangent.

Then enumerate a common tangent, common tangent on both sides of the answer is the number of programs were selected two points.

bzoj2961

Round inversion, transformation point to point within a circle on either side of the line.

Then into a dynamic cross half-plane, it may be converted to the convex hull do?

Inversion round

For a point \ (P \) , if \ (P \) to \ (O \) inversion, then \ (P \) still ray \ (OP \) , the distance into the original countdown.

However, a \ (O \) linearly after inversion into a through \ (O \) of the circle, and vice versa.

But \ (O \) after the inversion circle but still \ (O \) circle.

HDU4773

Round inversion, it becomes a particular sum of two common tangent circles. (Note that the original title require circumscribed, so you can not fool around common tangent)

Codechef QPOINT

Note that "disjoint" also ensures that the two polygons can not include each other.

The first segment consideration ray method, look up in front of a point, if it is then right to left in the polygon outside, or within the polygon. (Assuming that the edge is clockwise to go)

If offline, then press (x \) \ sort it out from left to right, because there is no intersecting edges, so use set well maintained.

You can not be off-line, so be persistent with treap maintenance.

Many of the details, perhaps an irrational number angle of rotation with a bit?

CF704 to

Sectional tree, the tree is converted to the problem issues sequences.

In time \ (X \) axis, the position \ (Y \) axis, then the displacement of a segment is a two-dimensional plane.

The problem is converted to \ (m \ log n \) line segments when the first intersection.

Press \ (X \) coordinate of the scan line, with \ (SET \) maintain all segments \ (Y \) relative size relationship.

If two segments have to pay, so they must have at some point in the set are adjacent.

And because we only required the first intersection, so we can assume that set inside the line never intersect, because when we went to the intersection of the time when we should return directly answer.

So each time adding a line judge at the time when the successor and predecessor intersect, update about the end of time. If the current time is beyond the end of the time then you can return directly.

CF799G

Set \ (f (x) \) indicates an angle \ (x \) in the area of radiation left minus the right area, then there \ (f (0) = - f (\ PI) \) .

So there must be an intermediate zero, this dichotomy can be zero.

After considering half of a polar angle how beg \ (f (the X-) \) . Can be obtained using the binary point of intersection of this ray and the variety of the convex hull, and then the prefix obtained by various areas, it is possible to \ (O (\ log n) \) to give \ (F (X) \) .

So we \ (O (n \ log ^ 2 n) \) to make the answer.

(Details sound particularly special multi ......)

Guess you like

Origin www.cnblogs.com/p-b-p-b/p/11305270.html