Box = axis-parallel box from 2 points: p1 = low x,y,z, p2 = high x,y,z. ===================================================== Liste_Funktionen_Beginn: ---------------- 2D ------------------------ UT2D_ckBoxinBox1 check if 2 boxes overlap UT2D_ckBoxinBox2 check if Box2 is complete in Box1 UT2D_pt_ck_inBox check if point is inside box UT2D_pt_ck_inBoxTol check if point p is inside box p1-p2 UT2D_rect_pts bounding rectangle <-- 2D-points UT2D_box_ini0 init box UT2D_box_extend Box mit point vergroessern ---------------- 3D ------------------------ UT3D_ckBoxinBox1 check if 2 boxes overlap UT3D_pt_ck_inBoxTol check if point p is inside box p1-p2 UT3D_ck_ptInBox check if point px is inside box p1-p2 UT3D_box_ck_intLn check if line intersects with axis-parallel box UT3D_box_ck_intpl check intersect. Plane / Box (estimate!) UT3D_box_ini0 init box UT3D_box_pts bounding box <-- points UT3D_box_2pt make box of 2 points UT3D_box_2pttol make box of 2 points + tol UT3D_box_tria make box from triangle UT3D_box_extend Box mit point vergroessern UT3D_box_addTol add tolerance to box UT3D_ptvc_intbox intersect point/vector with box UT3D_ch_lnbox check line-Interection with axis-parallel box (u3d.c) UT3D_ln_intbox relimit line inside box UT3D_cv_boxxy load rect.points from xmin/xmax ymin/ymax in z=0 Liste_Funktionen_Ende: ===================================================== - see also: UTO_box_obj Box mit obj vergroessern GR_Disp_box disp boundingBox
#include "../xa/MS_Def0.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "../ut/ut_geo.h"
#include "../db/ut_DB.h"
Functions | |
int | UT2D_box_ini0 (Point2 *pt1, Point2 *pt2) |
int | UT2D_box_extend (Point2 *pb1, Point2 *pb2, Point2 *pt1) |
int | UT3D_box_ini0 (Point *pt1, Point *pt2) |
int | UT2D_ckBoxinBox1 (Point2 *p1, Point2 *p2, Point2 *p3, Point2 *p4) |
int | UT2D_ckBoxinBox2 (Point2 *p1, Point2 *p2, Point2 *p3, Point2 *p4, double tol) |
int | UT2D_pt_ck_inBox (Point2 *p1, Point2 *p2, Point2 *p) |
int | UT2D_rect_pts (Point2 *pmin, Point2 *pmax, int nump, Point2 *ptab) |
int | UT3D_ckBoxinBox1 (Point *p1, Point *p2, Point *p3, Point *p4) |
int | UT2D_pt_ck_inBoxTol (Point2 *p1, Point2 *p2, Point2 *p, double tol) |
int | UT3D_box_pts (Point *pmin, Point *pmax, int nump, Point *ptab) |
int | UT3D_box_2pt (Point *pb1, Point *pb2, Point *pt1, Point *pt2) |
int | UT3D_box_tria (Point *pb1, Point *pb2, Triangle *tr, double tol) |
int | UT3D_box_2pttol (Point *pb1, Point *pb2, Point *pt1, Point *pt2, double tol) |
int | UT3D_box_extend (Point *pb1, Point *pb2, Point *pt1) |
int | UT3D_box_addTol (Point *pb1, Point *pb2, double tol) |
int | UT3D_ck_ptInBox (Point *p1, Point *p2, Point *px) |
int | UT3D_pt_ck_inBoxTol (Point *p1, Point *p2, Point *p, double tol) |
int | UT3D_box_ck_intLn (Line *ln, Point *pmin, Point *pmax, double tol) |
int | UT3D_box_ck_intpl (Plane *pln, Point *p1, Point *p2, double tol) |
int | UT3D_cv_boxxy (Point *pb1, double x1, double x2, double y1, double y2) |
int | UT3D_ln_intbox (Line *ln1, Point *bp1, Point *bp2) |
int | UT3D_ptvc_intbox (Point *pl, Vector *vl, Point *bp1, Point *bp2) |
check if 2 boxes overlap p1-p2 sind Box1, p3-p4 Box2. ACHTUNG: p1 muss links unter p2 liegen; p3 links unter p4. RC -1: NO, boxes do not overlap RC 1: yes boxes overlap.
check if Box2 is complete in Box1 p1-p2 sind Box1, p3-p4 Box2. ACHTUNG: p1 muss links unter p2 liegen; p3 links unter p4. RC -1: NO, boxes overlap RC 1: yes, Box2 is complete inside Box1
UT2D_pt_ck_inBox check if point p is inside box p1-p2 RC = 0: YES, p is inside box p1 / p2 RC = 1: NO, p is outside box p1 / p2
UT2D_rect_pts bounding rectangle <-- 2D-points Computation of a minimal axis-parallel rectangle which contains all given 2D-points. The rectangle is given by the endpoints of its diagonal. If all points ly on a line parallel x-, y- or z- axis, the rectangle will be a line segment. IN: int nump ... number of 2D-points Point2 *ptab ... 2D-points OUT: Point2 *pmin ... endpoint 1 of rectangle diagonal (lower left) Point2 *pmax ... endpoint 2 of rectangle diagonal (upper right) Returncodes: 0 = OK -1 = input error
check if 2 boxes overlap p1-p2 sind Box1, p3-p4 Box2. ACHTUNG: p1 muss links unter p2 liegen; p3 links unter p4. Toleranzen: schon zur Box dazuaddieren. RC -1: NO, boxes do not overlap RC 1: yes boxes overlap.
UT2D_pt_ck_inBoxTol check if point p is inside box p1-p2 RC = 0: YES, p is inside box p1 / p2 RC = 1: NO, p is outside box p1 / p2
UT3D_box_pts bounding box <-- points Computation of a minimal axis-parallel box which contains all given points. The box is given by the endpoints of its diagonal. If all points ly in a plane parallel x,y-plane, the box will be a rectangle. IN: int nump ... number of points Point *ptab ... points OUT: Point *pmin ... endpoint 1 of box diagonal Point *pmax ... endpoint 2 of box diagonal Returncodes: 0 = OK -1 = input error
UT3D_box_2pt make box of 2 points
UT3D_box_tria make box from triangle
UT3D_box_2pttol make box of 2 points + tol
UT3D_ck_ptInBox check if point px is inside box p1-p2 box should have tolerance added; use UT3D_box_addTol RC = 0: YES, p is inside box p1 / p2 RC = 1: NO, p is outside box p1 / p2
UT3D_pt_ck_inBoxTol check if point p is inside box p1-p2 RC = 0: YES, p is inside box p1 / p2 RC = 1: NO, p is outside box p1 / p2
UT3D_box_ck_intLn check line-X with axis-parallel box Check if a line intersects an axis-parallel box. IN: Line *ln ... line Point *pmin ... endpoint 1 of box diagonal Point *pmax ... endpoint 2 of box diagonal double tol ... tolerance for line intersecting box (>0) OUT: Returncodes: 0 = the line does not intersect the box 1 = the line intersects the box
UT3D_box_ck_intpl check intersect. Plane / Box (estimate!) ACHTUNG: dzt nur rasche Abschaetzung !!! Returncodes: 0 = plane does not intersect the box 1 = plane intersects the box
int UT3D_cv_boxxy | ( | Point * | pb1, | |
double | x1, | |||
double | x2, | |||
double | y1, | |||
double | y2 | |||
) |
UT3D_cv_boxxy load rect.points from xmin/xmax ymin/ymax in z=0
UT3D_ptvc_intbox intersect point/vector with box Input: pl ist ausserhalb box. vl zeigt in die box hinein. Output: pl ist der Schnittpunkt mit der am naechsten liegenden Boxplane.