2.5. Intersection
2.5.1. Intersection between curves
Figure 2.5.1 shows the index of the point nearest to the intersection on each curve, and the intersection point calculated by the two local segments. Function intersect_point can calculate the intersection points of multiple pairs of segments at the same time.
1i1, i2, points = intersect_index(x1, y1, x2, y2)
2
3intersection = intersect_point(p1, p2, p3, p4)
Figure 2.5.1 Intersection between curves
2.5.2. Intersection: vector v.s. plane
Figure 2.5.2 shows the intersection point between a vector and a plane. The plane P0123 is defined by three points P0, P1, P3, the vector V01 is defined by two points V0, V1. Function intersect_vec_plane calculates the intersection point xi, and its ratio in the V01, P01, P03 directions.
If rv is not in [0,1], then the segment V01 does not intersect with the plane P0123.
If t1, t3 are not in [0,1], then vector V01 does not intersect with the quadrangle P0123.
1xi, t1, t3, rv = intersect_vec_plane(V0, V1, P0, P1, P3)
Figure 2.5.2 Intersection between vector and plane
2.5.3. Intersection: surface v.s. plane
Figure 2.5.3 shows the intersection point between surfaces and a plane. The plane P0123 is defined by three points P0, P1, P3. The surface is an array surface [ni,nj,3]. Function intersect_surface_plane calculates the intersection points curve, the index of the point in surface to the intersection curve (ij_curve), and the ratio of intersection points in the P01, P03 directions (xi_curve, yt_curve).
1curve, ij_curve, xi_curve, yt_curve = intersect_surface_plane(
2 surface, P0, P1, P3, within_bounds=True, original_order=False)
Figure 2.5.3 Intersection between surface and plane
2.5.4. Slice curve from surface results
Slice the surface result (in Tecplot format) by a plane (locations, Pref, dir_norm), and extract data from the surface.
1sections, name_var = extract_slice(locations, Pref, dir_norm,
2 dir_ref=np.array([1.,0.,0.]), fname='surface-aircraft.dat',
3 zone_id=[], index_xyz=[0,1,2], arrange_method='join')