gCAD3D 2.35
ut_box.c File Reference

2D-boox, 3D-box More...

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "../ut/ut_geo.h"
#include "../ut/ut_cast.h"
#include "../ut/ut_ox_base.h"
#include "../gr/ut_DL.h"
#include "../gr/ut_gr.h"
#include "../db/ut_DB.h"

Functions

int UT2D_box_ini0 (Point2 *pt1, Point2 *pt2)
 
int UT3D_box_ck_empty (Point *pb1, Point *pb2)
 
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 UT2D_rect_pta3 (Point2 *p1, Point2 *p2, Point *pa, int pNr)
 
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_ix_npt (Point *pmin, Point *pmax, int *ia, int nump, Point *ptab)
 
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)
 
int UT3D_box_Torus (Point *pb1, Point *pb2, Torus *to1)
 
int UT3D_box_Conus (Point *pb1, Point *pb2, Conus *co1)
 
int UT3D_box_Sphere (Point *pb1, Point *pb2, Sphere *sp1)
 
int UT3D_box_CurvClot (Point *p1, Point *p2, CurvClot *clt)
 
int UT3D_box_AText (Point *p1, Point *p2, AText *tx1)
 
int UT3D_box_Dim3 (Point *p1, Point *p2, Dim3 *dim1)
 
int UT3D_box_Dimen (Point *p1, Point *p2, Dimen *dim1)
 
int UT3D_box_GText (Point *p1, Point *p2, GText *tx1)
 
int UT3D_box_mdr (Point *p1, Point *p2, ModelRef *mdr)
 
int UT3D_box_mdl__ (Point *PB1, Point *PB2, int iMdl)
 
int UT3D_box_obja (Point *pb1, Point *pb2, int form, int oNr, void *obj)
 
int UT3D_box_mdl_ck_pb (ModelBas *mb)
 
int UT3D_box_surMsh (Point *pb1, Point *pb2, ObjGX *ox1)
 
int UT3D_box_surStripe (Point *pb1, Point *pb2, ObjGX *ox1)
 
int UT3D_box_surRU (Point *pb1, Point *pb2, ObjGX *ox1)
 
int UT3D_box_surRV (Point *pb1, Point *pb2, ObjGX *ox1)
 
int UT3D_box_surBsp (Point *pb1, Point *pb2, ObjGX *ox1)
 
int UT3D_box_surSwp (Point *pb1, Point *pb2, ObjGX *ox1)
 
int UT3D_box_surPln (Point *pb1, Point *pb2, ObjGX *ox1)
 
int UT3D_box_SurStd (Point *pb1, Point *pb2, SurStd *sus)
 
int UT3D_box_ccv (Point *pb1, Point *pb2, CurvCCV *ccv)
 
int UT3D_box_elli (Point *p1, Point *p2, CurvElli *el1)
 
int UT3D_box_ln (Point *p1, Point *p2, Line *ln1)
 
int UT3D_box_ci (Point *p1, Point *p2, Circ *ci1)
 

Variables

Plane WC_sur_act
 the active construction-plane More...
 
double AP_txsiz
 Notes-Defaultsize. More...
 

Detailed Description

2D-boox, 3D-box

Box = axis-parallel box from 2 points:
p1 = low x,y,z,
p2 = high x,y,z.
=====================================================
List_functions_start:
---------------- 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_rect_pta3 bounding rectangle <-- 3D-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_ck_empty test if box is empty
UT3D_box_ix_npt get bounding-box for n points and find extreme points
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
see also UT3D_box_ox
UT3D_box_addTol add tolerance to box
// UT3D_box_Prism
UT3D_box_ox
UT3D_box_mdl__ was UT3D_box_model
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:
UT3D_box_ox Box mit obj vergroessern
GR_Disp_box disp boundingBox

Function Documentation

int UT2D_box_ini0 ( Point2 pt1,
Point2 pt2 
)

UT3D_box_ini0 init box

int UT3D_box_ck_empty ( Point pb1,
Point pb2 
)
test if box is empty
returns 0 = no, box has values
1 = yes box is empty (pb1 and pb2 == UT3D_PT_NUL)
int UT2D_box_extend ( Point2 pb1,
Point2 pb2,
Point2 pt1 
)
Box mit point vergroessern.
init Box zB mit UT3D_box_ini0
int UT3D_box_ini0 ( Point pt1,
Point pt2 
)

UT3D_box_ini0 init box

int UT2D_ckBoxinBox1 ( Point2 p1,
Point2 p2,
Point2 p3,
Point2 p4 
)
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.
int UT2D_ckBoxinBox2 ( Point2 p1,
Point2 p2,
Point2 p3,
Point2 p4,
double  tol 
)
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
int UT2D_pt_ck_inBox ( Point2 p1,
Point2 p2,
Point2 p 
)
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
int UT2D_rect_pts ( Point2 pmin,
Point2 pmax,
int  nump,
Point2 ptab 
)
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
int UT2D_rect_pta3 ( Point2 p1,
Point2 p2,
Point pa,
int  pNr 
)

UT2D_rect_pta3 bounding rectangle <– 3D-points

int UT3D_ckBoxinBox1 ( Point p1,
Point p2,
Point p3,
Point p4 
)
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.
int UT2D_pt_ck_inBoxTol ( Point2 p1,
Point2 p2,
Point2 p,
double  tol 
)
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
int UT3D_box_ix_npt ( Point pmin,
Point pmax,
int *  ia,
int  nump,
Point ptab 
)

UT3D_box_ix_npt get bounding-box for n points and find extreme points IN: int nump ... number of points Point *ptab ... points OUT: Point *pmin ... endpoint 1 of box diagonal Point *pmax ... endpoint 2 of box diagonal int ia[6] indices of xmin,ymin,zmin,xmax,ymax,zmax-points Returncodes: 0 = OK -1 = input error

UT3D_box_ini0 not necessary

int UT3D_box_pts ( Point pmin,
Point pmax,
int  nump,
Point ptab 
)
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
int UT3D_box_2pt ( Point pb1,
Point pb2,
Point pt1,
Point pt2 
)

UT3D_box_2pt make box of 2 points

int UT3D_box_tria ( Point pb1,
Point pb2,
Triangle tr,
double  tol 
)

UT3D_box_tria make box from triangle

int UT3D_box_2pttol ( Point pb1,
Point pb2,
Point pt1,
Point pt2,
double  tol 
)

UT3D_box_2pttol make box of 2 points + tol

int UT3D_box_extend ( Point pb1,
Point pb2,
Point pt1 
)
Box mit point vergroessern.
init Box zB mit UT3D_box_ini0
int UT3D_box_addTol ( Point pb1,
Point pb2,
double  tol 
)
UT3D_box_addTol add tolerance to box
int UT3D_ck_ptInBox ( Point p1,
Point p2,
Point px 
)
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
int UT3D_pt_ck_inBoxTol ( Point p1,
Point p2,
Point p,
double  tol 
)
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
create boxpoints p1,p2 with UT3D_box_2pt()
int UT3D_box_ck_intLn ( Line ln,
Point pmin,
Point pmax,
double  tol 
)
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
int UT3D_box_ck_intpl ( Plane pln,
Point p1,
Point p2,
double  tol 
)
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

int UT3D_ln_intbox ( Line ln1,
Point bp1,
Point bp2 
)
UT3D_ln_intbox relimit line inside box
Line an Raumbox begrenzen
int UT3D_ptvc_intbox ( Point pl,
Vector vl,
Point bp1,
Point bp2 
)
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.
int UT3D_box_Torus ( Point pb1,
Point pb2,
Torus to1 
)
int UT3D_box_Conus ( Point pb1,
Point pb2,
Conus co1 
)
int UT3D_box_Sphere ( Point pb1,
Point pb2,
Sphere sp1 
)
int UT3D_box_CurvClot ( Point p1,
Point p2,
CurvClot clt 
)
int UT3D_box_AText ( Point p1,
Point p2,
AText tx1 
)
int UT3D_box_Dim3 ( Point p1,
Point p2,
Dim3 dim1 
)
int UT3D_box_Dimen ( Point p1,
Point p2,
Dimen dim1 
)
int UT3D_box_GText ( Point p1,
Point p2,
GText tx1 
)
int UT3D_box_mdr ( Point p1,
Point p2,
ModelRef mdr 
)
int UT3D_box_mdl__ ( Point PB1,
Point PB2,
int  iMdl 
)
int UT3D_box_obja ( Point pb1,
Point pb2,
int  form,
int  oNr,
void *  obj 
)
UT3D_box_obja get box for structs
Input:
form type of struct of obj
oNr nr of structs in obj
retCod 0=ok, 1=skipped obj
int UT3D_box_mdl_ck_pb ( ModelBas mb)
Test if boxPoints pb1,pb2 of basic model mb are empty or not;
Output:
retCod 0 = box already already existing (pb1, pb2 have values)
1 = undefined
int UT3D_box_surMsh ( Point pb1,
Point pb2,
ObjGX ox1 
)
int UT3D_box_surStripe ( Point pb1,
Point pb2,
ObjGX ox1 
)
int UT3D_box_surRU ( Point pb1,
Point pb2,
ObjGX ox1 
)
box of ruled-surface.
Retcod: 0 = ok,
1 = 2 normal objects, make box of each obj.
int UT3D_box_surRV ( Point pb1,
Point pb2,
ObjGX ox1 
)
box of revolved-surface.
int UT3D_box_surBsp ( Point pb1,
Point pb2,
ObjGX ox1 
)
box of Bspl-surface.
int UT3D_box_surSwp ( Point pb1,
Point pb2,
ObjGX ox1 
)
box of SweepSurf
TODO: use points from creation (Tess_sur__ or Tess_sSym__)
int UT3D_box_surPln ( Point pb1,
Point pb2,
ObjGX ox1 
)
box of planar surface.
int UT3D_box_SurStd ( Point pb1,
Point pb2,
SurStd sus 
)
Box mit obj vergroessern; Box muss auf Maximum initialisiert sein !
siehe DL_ReScale_pt_ini
int UT3D_box_ccv ( Point pb1,
Point pb2,
CurvCCV ccv 
)
Box mit obj vergroessern; Box muss auf Maximum initialisiert sein !
siehe DL_ReScale_pt_ini
int UT3D_box_elli ( Point p1,
Point p2,
CurvElli el1 
)
box ellipse
360-deg: 4 points; p1 = cen + r-vx + r-vy
p2 = cen - r-vx - r-vy
else check p1, p2 and all points at 0,90,180,270-deg.
int UT3D_box_ln ( Point p1,
Point p2,
Line ln1 
)
unlimited lines: only definitionpoint
if UNL: midpoint;
if UNL1: startpt
if UNL1: endpt
int UT3D_box_ci ( Point p1,
Point p2,
Circ ci1 
)
box CIRC
360-deg: 2 points; p1 = cen + r-vx + r-vy
p2 = cen - r-vx - r-vy
else check p1, p2 and all points at 0,90,180,270-deg.

Variable Documentation

Plane WC_sur_act

the active construction-plane

double AP_txsiz

Notes-Defaultsize.