Classes | |
class | BREP_SOLID |
class | BREP_SHELL |
class | BREP_FACET |
class | BREP_CONTOUR |
class | BREP_WING |
class | BREP_EDGE |
class | BREP_VERTEX |
class | OctreeNode |
class | BrepSolidList |
struct | tmpSTLData |
データ読み込み用一時データ More... | |
struct | STLData |
class | CVFrame |
class | CVDisplay |
class | CVTextDocument |
class | CVCounter |
class | CRingBuffer |
class | Base64 |
class | CBVHTool |
class | CLogRingBuffer |
class | ExMSGraph |
class | ExCmnHead |
class | MSGraph |
class | MSGraphDisp |
class | TGAImage |
class | Matrix |
class | Quaternion |
class | AffineTrans |
class | TVector |
class | Vector |
class | PCoordinate |
class | RBound |
class | UVMap |
class | ColladaXML |
class | FacetTriIndex |
class | FacetTriData |
class | FacetBaseData |
class | TriPolyData |
class | TextureParam |
class | MaterialParam |
class | MeshObjectNode |
MeshObject の Polygonデータを格納するクラス.リスト構造を取る.. More... | |
class | MeshObjectData |
Typedefs | |
typedef std::list< BREP_SOLID * > | BREP_SOLID_LIST |
typedef std::list< BREP_SHELL * > | BREP_SHELL_LIST |
typedef std::list< BREP_FACET * > | BREP_FACET_LIST |
typedef std::list< BREP_CONTOUR * > | BREP_CONTOUR_LIST |
typedef std::list< BREP_EDGE * > | BREP_EDGE_LIST |
typedef std::list< BREP_WING * > | BREP_WING_LIST |
typedef std::list< BREP_VERTEX * > | BREP_VERTEX_LIST |
typedef std::vector< Vector < double > > | FACET_VECTOR_ARRAY |
typedef std::vector< Vector < float > > | FACET_VECTOR_ARRAY32 |
typedef std::vector < FacetTriIndex > | FACET_TRIINDX_ARRAY |
typedef std::vector< FacetTriData > | FACET_TRIDATA_ARRAY |
Functions | |
DllExport BREP_WING * | CreateWingWithoutContour (BREP_VERTEX *vertex1, BREP_VERTEX *vertex2) |
DllExport BREP_WING * | GetWingOtherSide (BREP_WING *wing) |
DllExport BREP_EDGE * | FindEdge (BREP_VERTEX *vertex1, BREP_VERTEX *vertex2) |
DllExport BREP_EDGE * | CreateEdge (BREP_VERTEX *v1, BREP_VERTEX *v2) |
DllExport BREP_VERTEX * | AddVertex2Octree (BREP_VERTEX *vertex, OctreeNode *octree, bool dupli=false) |
DllExport BREP_VERTEX ** | GetOctreeVertices (OctreeNode *octree, long int *vertexno) |
DllExport long int | OctreeGetter (OctreeNode *p, BREP_VERTEX **vtx, long int counter) |
DllExport void | ConnectWingToVertex (BREP_WING *wing) |
DllExport void | DestroyWing (BREP_WING *wing) |
DllExport int | CompareVertex (BREP_VERTEX *v1, BREP_VERTEX *v2) |
DllExport TVector< double > | Vertex2TVector (BREP_VERTEX *v) |
void | freeBrepSolid (BREP_SOLID *&solid) |
void | freeBrepSolidList (BrepSolidList *&solids) |
DllExport STLData * | ReadSTLFile (char *fname, long int *fno) |
DllExport int | WriteSTLFile (char *fname, BREP_SOLID *solid, bool ascii=false) |
DllExport int | WriteSTLFile (char *fname, BREP_SOLID_LIST solid_list, bool ascii=false) |
DllExport STLData * | ReadSTLFileA (char *fname, long int *fno) |
DllExport STLData * | ReadSTLFileB (char *fname, long int *fno) |
DllExport int | WriteSTLFileA (char *fname, BREP_SOLID *solid) |
DllExport int | WriteSTLFileB (char *fname, BREP_SOLID *solid) |
DllExport int | WriteSTLFileA (char *fname, BREP_SOLID_LIST solid_list) |
DllExport int | WriteSTLFileB (char *fname, BREP_SOLID_LIST solid_list) |
DllExport void | println_FacetAsciiSTL (BREP_CONTOUR *contour) |
DllExport void | freeSTL (STLData *stldata) |
DllExport BREP_CONTOUR * | CreateContourByVector (BREP_FACET *facet, Vector< double > *vect, Vector< double > *nrml=NULL, UVMap< double > *uv=NULL, bool dupli=false) |
DllExport BREP_CONTOUR * | CreateContourByVertex (BREP_FACET *facet, BREP_VERTEX **vect) |
DllExport void | CreateContoursList (BREP_SOLID *solid) |
DllExport void | CreateWingsList (BREP_SOLID *solid) |
DllExport void | CreateSurplusContoursList (BREP_SOLID *solid) |
DllExport void | CreateShortageWingsList (BREP_SOLID *solid) |
DllExport void | DeleteSurplusContours (BREP_SOLID *solid) |
DllExport void | DeleteStraightEdges (BREP_SOLID *solid) |
DllExport void | DeleteShortageWings (BREP_SOLID *solid) |
DllExport void | FillShortageWings (BREP_SOLID *solid, int method, bool mode) |
DllExport int | FillShortageWings_Next (BREP_SOLID *solid, bool mode) |
DllExport int | FillShortageWings_Near (BREP_SOLID *solid, bool mode) |
DllExport bool | PatchupContour (BREP_SHELL *shell, BREP_VERTEX **vert, bool mode) |
DllExport void | JoinShortageWings (BREP_SOLID *solid) |
DllExport void | SetMinVertex (BREP_VERTEX_LIST *list, BREP_VERTEX *vrtx) |
DllExport bool | IsIncludeCompleteEdge (BREP_WING *wing) |
DllExport BREP_VERTEX * | FindConnectEdgeVertex (BREP_VERTEX *vert) |
DllExport int | DupEdgeNumber (BREP_CONTOUR *contour) |
DllExport void | ReverseContours (BREP_SOLID *solid) |
DllExport void | SetDeletableContoursByEdge (BREP_EDGE *edge) |
DllExport void | FastDeleteFacet (BREP_FACET *facet) |
DllExport int | IsAtLine (BREP_VERTEX **v) |
DllExport bool | IsForbiddenEdge (BREP_VERTEX **vert) |
DllExport bool | IsCollisionContours (BREP_SOLID *solid, BREP_CONTOUR *contour, BREP_CONTOUR **collision) |
DllExport bool | CollisionTriContour3D (BREP_CONTOUR *contour1, BREP_CONTOUR *contour2) |
DllExport bool | CollisionTriContour2D (BREP_CONTOUR *contour1, BREP_CONTOUR *contour2) |
DllExport bool | IsInTriangle (BREP_CONTOUR *contour1, BREP_CONTOUR *contour2) |
DllExport int | CommonVertex (BREP_CONTOUR *contour1, BREP_CONTOUR *contour2) |
DllExport bool | SamePlaneContour (BREP_CONTOUR *contour1, BREP_CONTOUR *contour2, int &lineno) |
DllExport int | CreateTriSolidFromSTL (BREP_SOLID *solid, STLData *stldata, int fno, bool check=true) |
DllExport int | CreateTriSolidFromVector (BREP_SOLID *solid, int vno, Vector< double > *v, Vector< double > *n=NULL, UVMap< double > *uv=NULL, bool dupli=false, bool check=true) |
DllExport void | AddVector2TriSolid (BREP_SOLID *solid, BREP_SHELL *shell, Vector< double > *v, Vector< double > *n=NULL, UVMap< double > *uv=NULL, bool dupli=false) |
DllExport int | CloseTriSolid (BREP_SOLID *solid, bool check=true, CVCounter *counter=NULL) |
DllExport bool | IsConnectEdges (BREP_WING *wing1, BREP_WING *wing2) |
void | SetGlobalFrame (CVFrame *frm) |
グローバルドキュメントのセット | |
void | ClearGlobalFrame () |
グローバルドキュメントのクリア | |
void | SetGlobalDisplay (CVDisplay *disp) |
グローバルドキュメントのセット | |
void | ClearGlobalDisplay () |
グローバルドキュメントのクリア | |
void | SetGlobalTextDocument (CVTextDocument *doc) |
グローバルドキュメントのセット | |
void | ClearGlobalTextDocument () |
グローバルドキュメントのクリア | |
CVCounter * | GetUsableGlobalCounter () |
現在有効なグローバルカウンタを得る.(子カウンタを得るかもしれない) | |
void | SetGlobalCounter (CVCounter *counter) |
グローバルカウンタのセット | |
void | ClearGlobalCounter () |
グローバルカウンタのクリア | |
bool | isNull (void *p) |
template<typename T > | |
void | freeNull (T &p) |
template<typename T > | |
void | deleteNull (T &p) |
template<typename T > | |
tList * | add_tList_object (tList *lt, T obj) |
template<typename T > | |
void | del_tList_object (tList **lp) |
void | DisPatcher (int sno=0,...) |
void | free_CmnHead (CmnHead *hd) |
void | init_CmnHead (CmnHead *hd) |
CmnHead | getinfo_CmnHead (CmnHead hd) |
ヘッダ情報のみをコピーする | |
uByte & | CmnHeadBytePoint (CmnHead hd, int i=0, int j=0, int k=0) |
共通ヘッダCmnHeadから座標を指定して,画像データを取り出す | |
template<typename T > | |
MSGraph< T > | copyCmnHead2MSGraph (CmnHead hd, unsigned int mode=CH2MG_NORMAL, bool cnt=false) |
template<typename T > | |
CmnHead | copyMSGraph2CmnHead (MSGraph< T > &vp, unsigned int mode=MG2CH_NORMAL, bool cnt=false) |
template<typename T > | |
MSGraph< T > | scalingMSGraph2D (MSGraph< T > vp, double scale) |
unsigned int | ARGB2Int (unsigned int a, unsigned int r, unsigned int g, unsigned int b) |
uWord | ARGB2Word (uWord a, uWord r, uWord g, uWord b) |
uWord | RGB2Word (uWord r, uWord g, uWord b) |
CmnHead | readUserSetData (FILE *fp, CmnHead *ch, bool cnt=false) |
read_user_data() for C // ユーザ指定(ch)のデータ形式でファイルを読み込む | |
CmnHead | readRasData (FILE *fp) |
read_ras_data() for C // SUN RASTER形式のファイルを読み込む | |
int | writeRasData (FILE *fp, CmnHead *ch, int obit=8) |
write_ras_data() for C | |
CmnHead | readMoonFile (const char *fn, bool no_ntoh=false) |
CmnHead | readMoonData (FILE *fp, unsigned int fsz=0, bool no_ntoh=false) |
int | dicomHeader (FILE *fp, int fsize, int *dsize, int *xsize, int *ysize, int *depth, double *rzxy) |
MSGraph< sWord > | readDicomFile (const char *fn) |
MSGraph< sWord > | readDicomData (FILE *fp, int fsz) |
CmnHead | readXHead (const char *fn, CmnHead *ch=NULL) |
ヘッダ部分のみ読み込み | |
CmnHead | readXHeadFile (const char *fn, CmnHead *ch=NULL, bool cnt=false) |
拡張read関数.ファイルを自動判別して読み込む. | |
CmnHead | readCmnHeadFile (const char *fn, CmnHead *ch, bool cnt=false) |
拡張read関数.ファイル種別を指定して読み込む. | |
int | writeCmnHeadFile (const char *fn, CmnHead *hd, bool cnt=false) |
int | writeCmnHeadData (FILE *fp, CmnHead *hd, bool cnt=false) |
template<typename T > | |
MSGraph< T > | readGraphicFile (const char *fname, CmnHead *chd=NULL, bool cnt=false) |
template<typename T > | |
MSGraph< T > | readGraphicSlices (const char *fmt, int fst, int fnd, CmnHead *chd=NULL, bool cnt=false) |
template<typename T > | |
int | writeGraphicFile (const char *fname, MSGraph< T > vp, int kind=0, int mlt=FALSE, int fnum=0, int tnum=0, bool cnt=false) |
template<typename T > | |
int | writeRasFile (const char *fname, MSGraph< T > vp) |
template<typename T > | |
MSGraph< T > | readRasFile (const char *fname) |
template<typename R , typename T > | |
MSGraph< R > | Laplacian (MSGraph< T > vp, int mode=0) |
template<typename R , typename T > | |
MSGraph< R > | xSobel (MSGraph< T > vp) |
template<typename R , typename T > | |
MSGraph< R > | ySobel (MSGraph< T > vp) |
template<typename R , typename T > | |
MSGraph< R > | zSobel (MSGraph< T > vp) |
template<typename R , typename T > | |
MSGraph< R > | xxSobel (MSGraph< T > vp) |
template<typename R , typename T > | |
MSGraph< R > | yySobel (MSGraph< T > vp) |
template<typename R , typename T > | |
MSGraph< R > | zzSobel (MSGraph< T > vp) |
template<typename R , typename T > | |
MSGraph< Vector< R > > | vNabla (MSGraph< T > vp) |
template<typename R , typename T > | |
MSGraph< R > | Nabla (MSGraph< T > vp) |
template<typename R , typename T > | |
MSGraph< R > | edgeEnhance (MSGraph< T > gd, int mode=0) |
template<typename T > | |
MSGraph< T > | medianFilter (MSGraph< T > xp, int ms=3) |
template<typename T > | |
MSGraph< int > | euclidDistance (MSGraph< T > vp, int bc, int &rr) |
template<typename R , typename T > | |
MSGraph< R > | MSMaskFilter (MSGraph< R > vp, MSGraph< T > filter, int mode=FILTER_NON) |
void | rotate_point (int &x, int &y, double sxc, double syc, double dxc, double dyc, double cst, double snt) |
void | rotate_point_angle (int &x, int &y, double sxc, double syc, double dxc, double dyc, double th) |
template<typename T > | |
Vector< double > | dgree_circle_MSGraph (MSGraph< T > vp) |
template<typename T > | |
Vector< double > | object_feature_MSGraph (MSGraph< T > vp, int mn, int mx) |
template<typename T > | |
double | count_around_MSGraph (MSGraph< T > vp) |
template<typename T > | |
int | count_area_MSGraph (MSGraph< T > xp) |
template<typename T > | |
int | count_object_MSGraph (MSGraph< T > xp, int mn, int mx) |
template<typename T > | |
RBound< int > | out_around_MSGraph (MSGraph< T > vp, int x, int y, int mode=8) |
template<typename T > | |
RBound< int > | get_boundary_MSGraph (MSGraph< T > vp, T mn, T mx) |
template<typename T , typename R > | |
void | cat_MSGraph (MSGraph< R > src, MSGraph< T > &dst) |
template<typename T , typename R > | |
void | cat_MSGraph (MSGraph< R > *src, MSGraph< T > *dst) |
template<typename R , typename T > | |
void | copy_MSGraph (MSGraph< R > src, MSGraph< T > &dst) |
template<typename R , typename T > | |
void | copy_MSGraph (MSGraph< R > *src, MSGraph< T > *dst) |
template<typename T > | |
MSGraph< T > | dup_MSGraph (MSGraph< T > src) |
template<typename T > | |
MSGraph< T > * | dup_MSGraph (MSGraph< T > *src) |
template<typename T > | |
void | ToPola (Vector< T > nv, double &cst, double &snt, double &csf, double &snf, double pcsf=0.0, double psnf=1.0) |
template<typename T , typename R > | |
void | Local2World (MSGraph< T > gd, MSGraph< T > vp, Vector< R > oq, Vector< R > op, Vector< R > ex, double *pcsf=NULL, double *psnf=NULL) |
template<typename T > | |
void | MSGraph_changeColor (MSGraph< T > vp, int f, int t) |
template<typename T > | |
int | MSGraph_Paint (MSGraph< T > vp, int x, int y, int mn, int mx, int cc, int mode=8) |
template<typename T > | |
int | MSGraph_Paint3D (MSGraph< T > vp, int x, int y, int z, int mn, int mx, int cc, int mode=8) |
template<typename T > | |
void | MSGraph_Line (MSGraph< T > vp, int x1, int y1, int x2, int y2, int cc) |
template<typename T > | |
void | MSGraph_Triangle (MSGraph< T > vp, int x1, int y1, int x2, int y2, int x3, int y3, int cc, int mode=OFF) |
template<typename T > | |
void | MSGraph_Box (MSGraph< T > vp, int x1, int y1, int x2, int y2, int cc, int mode=OFF) |
template<typename T > | |
void | MSGraph_Line3D (MSGraph< T > vp, int x1, int y1, int z1, int x2, int y2, int z2, int cc) |
template<typename T > | |
void | MSGraph_Circle (MSGraph< T > vp, int x, int y, int r, int cc, int mode=OFF) |
template<typename T > | |
void | MSGraph_Circle3D (MSGraph< T > vp, Vector<> ox, Vector<> ex, int rr, int cc, int mode=OFF) |
template<typename T > | |
void | MSGraph_Pool (MSGraph< T > vp, Vector<> a, Vector<> b, int rr, int cc) |
template<typename T > | |
void | MSGraph_Torus (MSGraph< T > vp, Vector<> ox, Vector<> ex, int rr, int ra, int cc) |
template<typename T > | |
void | MSGraph_Sphere (MSGraph< T > vp, Vector<> a, int r, int cc, int mode=1) |
template<typename T > | |
MSGraph< T > | cut_object_MSGraph (MSGraph< T > vp, int mn, int mx, int blank=BOUNDARY_BLANK, bool ecnt=false) |
template<typename T > | |
MSGraph< T > | cut_object_MSGraph (MSGraph< T > vp, int mn, int mx, RBound< int > rbound, int blank=BOUNDARY_BLANK, bool ecnt=false) |
template<typename T > | |
MSGraph< T > | cut_object_MSGraph (MSGraph< T > vp, RBound< int > rb, bool ecnt=false) |
template<typename T > | |
MSGraph< T > | zoom_MSGraph (MSGraph< T > vp, double zm, int mode=ON) |
template<typename T > | |
MSGraph< T > | reduce_MSGraph (MSGraph< T > vp, double rc, int mode=ON) |
template<typename T > | |
MSGraph< T > | rotate_MSGraph (MSGraph< T > vp, int xs, int ys, double cst, double snt, int mode=ON) |
template<typename T > | |
MSGraph< T > | rotate_MSGraph (MSGraph< T > vp, double th, int mode=ON) |
template<typename T > | |
MSGraph< T > | x_reverse_MSGraph (MSGraph< T > vp, bool ecnt=false) |
template<typename T > | |
void | set_around_MSGraph (MSGraph< T > vp, int cc=0, int size=1) |
template<typename T > | |
MSGraph< T > | grab_MSGraph (MSGraph< T > vp, int x1, int y1, int x2, int y2, int zs=0, int ze=0) |
template<typename T > | |
MSGraph< T > * | grab_MSGraph (MSGraph< T > *vp, int x1, int y1, int x2, int y2, int zs=0, int ze=0) |
template<typename T > | |
int | addPaint_MSGraph (MSGraph< T > xp, int x, int y, int mn, int mx, int add, int mode=8) |
template<typename T > | |
MSGraph< T > | Density_Mask (MSGraph< T > vp, double rate, int mode=8, int work_color=0) |
template<typename T > | |
MSGraph< T > | Density_Filter (MSGraph< T > vp, int size, double rate, int mode=8, int work_color=0) |
template<typename T > | |
void | delete_noise_MSGraph (MSGraph< T > vp, int size, int mode=8, int work_color=0) |
template<typename T > | |
MSGraph< T > | Morphology (MSGraph< T > vp, MSGraph< T > xp, int cc, int mode) |
template<typename T > | |
MSGraph< T > | opening_morph (MSGraph< T > vp, MSGraph< T > xp, int cc) |
template<typename T > | |
bool | point_open_morph (MSGraph< T > vp, int x, int y, int z, MSGraph< T > xp, int cc) |
template<typename T > | |
void | copy_morph_element (MSGraph< T > vp, int x, int y, int z, MSGraph< T > xp) |
template<typename T > | |
MSGraph< T > | fat_object_morph (MSGraph< T > vp, MSGraph< T > xp, int cc) |
template<typename T > | |
bool | point_fat_object_morph (MSGraph< T > vp, int x, int y, int z, MSGraph< T > xp, int cc) |
template<typename T > | |
MSGraph< T > | make_element_morph (Parameter32 x) |
template<typename T > | |
rectangle * | cvDetectObjects (cv::CascadeClassifier cascade, MSGraph< T > *vp, int &num, int sz=0, double scale=1.0) |
template<typename R , typename T > | |
cv::Mat | copyMSGraph2CvMat (MSGraph< T > *vp) |
template<typename T > | |
MSGraph< T > * | getMSGraphFromCvMat (cv::Mat mat) |
template<typename T , typename R > | |
MSGraph< T > * | _getMSGraph_CvMat_C1 (cv::Mat mat) |
template<typename T , typename R > | |
MSGraph< T > * | _getMSGraph_CvMat_C3 (cv::Mat mat) |
template<typename R , typename T > | |
int | _linecopy_MAT2MSG_C3 (R *src, T *dst, int len, int sz) |
TGAImage | readTGAFile (const char *fname) |
TGAImage | readTGAData (FILE *fp) |
int | writeTGAFile (const char *fname, TGAImage tga) |
int | writeTGAData (FILE *fp, TGAImage tga) |
template<typename T > | |
MSGraph< T > | TGAImage2MSGraph (TGAImage tga) |
template<typename T > | |
TGAImage | MSGraph2TGAImage (MSGraph< T > vp) |
template<typename T > | |
MSGraph< T > | CenterLine (MSGraph< T > gx, int mode) |
template<typename T > | |
int | nonZeroBoxel (MSGraph< T > vp, int n) |
template<typename T > | |
bool | deletable (MSGraph< T > vp, int n, int c, int d) |
int | connectNumber (int *w, int c, int d) |
bool | deletable_s (int *v) |
bool | deletable_4 (int *v) |
bool | deletable_5 (int *v) |
template<typename T > | |
MSGraph< T > | centerLine (MSGraph< T > gx, int mode) |
template<typename T > | |
void | wSetPixel (MSGraph< T > vp, double x, double y, int cc) |
template<typename T > | |
void | wSetPixel3D (MSGraph< T > vp, double x, double y, double z, int cc) |
template<typename T > | |
T | wGetPixel (MSGraph< T > vp, double x, double y) |
template<typename T > | |
T | wGetPixel3D (MSGraph< T > vp, double x, double y, double z) |
template<typename T > | |
void | wLine (MSGraph< T > vp, double x1, double y1, double x2, double y2, int cc) |
template<typename T > | |
void | wLine3D (MSGraph< T > vp, double x1, double y1, double z1, double x2, double y2, double z2, int cc) |
template<typename T > | |
void | wCircle3D (MSGraph< T > vp, Vector< double > ox, Vector< double > ex, double rr, int cc, int mode) |
template<typename T > | |
void | wDraw (MSGraph< T > *vp, double x, double y, int cc) |
template<typename T > | |
void | wDraw3D (MSGraph< T > *vp, double x, double y, double z, int cc) |
template<typename T > | |
void | wDraw_rel (MSGraph< T > *vp, double x, double y, int cc) |
template<typename T > | |
void | wDraw_rel3D (MSGraph< T > *vp, double x, double y, double z, int cc) |
template<typename T > | |
void | print_Matrix (FILE *fp, Matrix< T > a) |
template<typename T > | |
Matrix< T > | dup_Matrix (Matrix< T > a) |
template<typename T > | |
Matrix< T > | operator* (const Matrix< T > a, const Matrix< T > b) |
template<typename T > | |
Vector< T > | operator* (const Matrix< T > a, const Vector< T > v) |
template<typename T > | |
Matrix< T > | operator- (const Matrix< T > a) |
template<typename T > | |
Matrix< T > | operator+ (const Matrix< T > a, const Matrix< T > b) |
template<typename T > | |
Matrix< T > | operator- (const Matrix< T > a, const Matrix< T > b) |
template<typename T , typename R > | |
Matrix< T > | operator* (const R d, const Matrix< T > a) |
template<typename T , typename R > | |
Matrix< T > | operator* (const Matrix< T > a, const R d) |
template<typename T , typename R > | |
Matrix< T > | operator/ (const Matrix< T > a, const R d) |
template<typename T > | |
bool | operator== (const Matrix< T > v1, const Matrix< T > v2) |
template<typename T > | |
bool | isSameDimension (const Matrix< T > v1, const Matrix< T > v2) |
template<typename T > | |
Vector< T > | Quaternion2ExtEulerXYZ (Quaternion< T > qut, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | Quaternion2ExtEulerZYX (Quaternion< T > qut, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | Quaternion2ExtEulerXZY (Quaternion< T > qut, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | Quaternion2ExtEulerYZX (Quaternion< T > qut, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | Quaternion2ExtEulerYXZ (Quaternion< T > qut, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | Quaternion2ExtEulerZXY (Quaternion< T > qut, Vector< T > *vct=NULL) |
template<typename T > | |
bool | operator== (const Quaternion< T > q1, const Quaternion< T > q2) |
template<typename T > | |
bool | operator!= (const Quaternion< T > q1, const Quaternion< T > q2) |
~ 共役 | |
template<typename T > | |
Quaternion< T > | operator~ (const Quaternion< T > a) |
template<typename T > | |
Quaternion< T > | operator- (const Quaternion< T > a) |
template<typename T > | |
Quaternion< T > | operator+ (const Quaternion< T > a, const Quaternion< T > b) |
template<typename T > | |
Quaternion< T > | operator- (const Quaternion< T > a, const Quaternion< T > b) |
template<typename T , typename R > | |
Quaternion< T > | operator* (const R d, const Quaternion< T > a) |
template<typename T , typename R > | |
Quaternion< T > | operator* (const Quaternion< T > a, const R d) |
template<typename T , typename R > | |
Quaternion< T > | operator/ (const Quaternion< T > a, const R d) |
template<typename T > | |
Quaternion< T > | operator* (const Quaternion< T > a, const Quaternion< T > b) |
template<typename T > | |
Quaternion< T > | operator* (const Quaternion< T > q, const Vector< T > v) |
template<typename T > | |
Quaternion< T > | operator* (const Vector< T > v, const Quaternion< T > q) |
template<typename T > | |
Quaternion< T > | ExtEulerXYZ2Quaternion (Vector< T > e) |
template<typename T > | |
Quaternion< T > | ExtEulerZYX2Quaternion (Vector< T > e) |
template<typename T > | |
Quaternion< T > | ExtEulerXZY2Quaternion (Vector< T > e) |
template<typename T > | |
Quaternion< T > | ExtEulerYZX2Quaternion (Vector< T > e) |
template<typename T > | |
Quaternion< T > | ExtEulerYXZ2Quaternion (Vector< T > e) |
template<typename T > | |
Quaternion< T > | ExtEulerZXY2Quaternion (Vector< T > e) |
template<typename T > | |
void | freeAffineTrans (AffineTrans< T > *&affine) |
template<typename T > | |
AffineTrans< T > * | newAffineTrans (AffineTrans< T > p) |
template<typename T > | |
AffineTrans< T > | operator* (const AffineTrans< T > a, const AffineTrans< T > b) |
template<typename T > | |
Matrix< T > | ExtEulerXYZ2RotMatrix (Vector< T > eul) |
template<typename T > | |
Matrix< T > | ExtEulerZYX2RotMatrix (Vector< T > eul) |
template<typename T > | |
Matrix< T > | ExtEulerXZY2RotMatrix (Vector< T > eul) |
template<typename T > | |
Matrix< T > | ExtEulerYZX2RotMatrix (Vector< T > eul) |
template<typename T > | |
Matrix< T > | ExtEulerZXY2RotMatrix (Vector< T > eul) |
template<typename T > | |
Matrix< T > | ExtEulerYXZ2RotMatrix (Vector< T > eul) |
template<typename T > | |
Vector< T > | RotMatrixElements2ExtEulerXYZ (T m11, T m12, T m13, T m21, T m31, T m32, T m33, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | RotMatrixElements2ExtEulerZYX (T m11, T m12, T m13, T m21, T m23, T m31, T m33, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | RotMatrixElements2ExtEulerXZY (T m11, T m12, T m13, T m21, T m22, T m23, T m31, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | RotMatrixElements2ExtEulerYZX (T m11, T m12, T m13, T m21, T m22, T m31, T m32, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | RotMatrixElements2ExtEulerYXZ (T m12, T m21, T m22, T m23, T m31, T m32, T m33, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | RotMatrixElements2ExtEulerZXY (T m12, T m13, T m21, T m22, T m23, T m32, T m33, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | RotMatrix2ExtEulerXYZ (Matrix< T > mtx, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | RotMatrix2ExtEulerZYX (Matrix< T > mtx, Vector< T > *vct) |
template<typename T > | |
Vector< T > | RotMatrix2ExtEulerXZY (Matrix< T > mtx, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | RotMatrix2ExtEulerYZX (Matrix< T > mtx, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | RotMatrix2ExtEulerYXZ (Matrix< T > mtx, Vector< T > *vct=NULL) |
template<typename T > | |
Vector< T > | RotMatrix2ExtEulerZXY (Matrix< T > mtx, Vector< T > *vct=NULL) |
template<typename T > | |
Quaternion< T > | RotMatrix2Quaternion (Matrix< T > mtx) |
template<typename T > | |
Vector< T > | VectorRotation (Vector< T > v, Quaternion< T > q) |
template<typename T > | |
Vector< T > | VectorInvRotation (Vector< T > v, Quaternion< T > q) |
template<typename T > | |
T * | VectorRotation (T *v, Quaternion< T > q) |
template<typename T > | |
T * | VectorInvRotation (T *v, Quaternion< T > q) |
template<typename T > | |
Quaternion< T > | V2VQuaternion (Vector< T > a, Vector< T > b) |
template<typename T > | |
Quaternion< T > | PPPQuaternion (Vector< T > a, Vector< T > b, Vector< T > c) |
template<typename T > | |
Quaternion< T > | VPPQuaternion (Vector< T > a, Vector< T > b, Vector< T > c) |
template<typename T > | |
Quaternion< T > | PPVQuaternion (Vector< T > a, Vector< T > b, Vector< T > c) |
template<typename T > | |
Quaternion< T > | SlerpQuaternion (Quaternion< T > qa, Quaternion< T > qb, T t) |
void | SetZeroEPS (double eps) |
void | SetVectorTolerance (double tol) |
void | SetVertexTolerance (double tol) |
void | SetEdgeTolerance (double tol) |
void | SetFacetTolerance (double tol) |
void | SetCollisionTolerance (double tol) |
void | SetSINTolerance (double tol) |
void | SetAbsVectorTolerance (double tol) |
void | SetAbsVertexTolerance (double tol) |
template<typename T > | |
double | ProportionVector (TVector< T > v1, TVector< T > v2, T &t) |
template<typename T > | |
TVector< T > | operator- (const TVector< T > a) |
template<typename T > | |
TVector< T > | operator+ (const TVector< T > a, const TVector< T > b) |
template<typename T , typename R > | |
TVector< T > | operator+ (const R d, const TVector< T > a) |
template<typename T , typename R > | |
TVector< T > | operator+ (const TVector< T > a, const R d) |
template<typename T > | |
TVector< T > | operator- (const TVector< T > a, const TVector< T > b) |
template<typename T , typename R > | |
TVector< T > | operator- (const R d, const TVector< T > a) |
template<typename T , typename R > | |
TVector< T > | operator- (const TVector< T > a, const R d) |
template<typename T , typename R > | |
TVector< T > | operator* (const R d, const TVector< T > a) |
template<typename T , typename R > | |
TVector< T > | operator* (const TVector< T > a, const R d) |
template<typename T , typename R > | |
TVector< T > | operator/ (const TVector< T > a, const R d) |
template<typename T , typename R > | |
TVector< T > | operator/ (const R d, const TVector< T > a) |
template<typename T > | |
bool | operator== (const TVector< T > v1, const TVector< T > v2) |
template<typename T > | |
bool | operator!= (const TVector< T > v1, const TVector< T > v2) |
template<typename T > | |
TVector< T > | operator^ (const TVector< T > a, const TVector< T > b) |
Cross product 外積. | |
template<typename T > | |
T | operator* (const TVector< T > a, const TVector< T > b) |
Dot product 内積. | |
template<typename T > | |
T | TVectorMultiTolerance (TVector< T > a, TVector< T > b) |
内積の誤差 | |
template<typename T > | |
Vector< T > | operator- (const Vector< T > a) |
template<typename T > | |
Vector< T > | operator+ (const Vector< T > a, const Vector< T > b) |
template<typename T , typename R > | |
Vector< T > | operator+ (const Vector< T > a, R c) |
template<typename T , typename R > | |
Vector< T > | operator+ (const R c, Vector< T > a) |
template<typename T > | |
Vector< T > | operator- (const Vector< T > a, const Vector< T > b) |
template<typename T , typename R > | |
Vector< T > | operator- (const Vector< T > a, R c) |
template<typename T , typename R > | |
Vector< T > | operator- (R c, const Vector< T > a) |
template<typename T , typename R > | |
Vector< T > | operator* (const R d, const Vector< T > a) |
template<typename T , typename R > | |
Vector< T > | operator* (const Vector< T > a, const R d) |
template<typename T , typename R > | |
Vector< T > | operator/ (const Vector< T > a, const R d) |
template<typename T , typename R > | |
Vector< T > | operator/ (const R d, const Vector< T > a) |
template<typename T > | |
Vector< T > | operator^ (const Vector< T > a, const Vector< T > b) |
Cross product 外積. | |
template<typename T > | |
T | operator* (const Vector< T > a, const Vector< T > b) |
Dot product 内積. | |
template<typename T > | |
bool | operator== (const Vector< T > v1, const Vector< T > v2) |
template<typename T > | |
bool | operator!= (const Vector< T > v1, const Vector< T > v2) |
template<typename T > | |
Vector< T > | MidPoint (const Vector< T > a, const Vector< T > b) |
template<typename T > | |
double | VectorDist (const Vector< T > a, const Vector< T > b) |
点a と b の距離 (a,b は位置ベクトル) | |
template<typename T > | |
bool | operator< (const Vector< T > v1, const Vector< T > v2) |
template<typename T > | |
bool | same_vector (Vector< T > v1, Vector< T > v2) |
template<typename T > | |
Vector< T > * | dupVector (Vector< T > *a, int n) |
template<typename T > | |
double | VectorAngle (Vector< T > a, Vector< T > b) |
template<typename T > | |
double | VectorAngle (Vector< T > a, Vector< T > b, Vector< T > c) |
template<typename T > | |
Vector< T > | NewellMethod (Vector< T > v1, Vector< T > v2, Vector< T > v3) |
Normal Vector of 3 Vectors with Newell Mothod. | |
template<typename T > | |
Vector< T > | NewellMethod3 (Vector< T > v1, Vector< T > v2, Vector< T > v3) |
template<typename T > | |
Vector< T > | NewellMethod4 (Vector< T > v1, Vector< T > v2, Vector< T > v3, Vector< T > v4) |
template<typename T > | |
Vector< T > | BSplineInterp4 (Vector< T > p0, Vector< T > p1, double t) |
template<typename T > | |
bool | disJunctBounds (RBound< T > b1, RBound< T > b2) |
template<typename T > | |
UVMap< T > | operator- (const UVMap< T > a) |
template<typename T > | |
UVMap< T > | operator+ (const UVMap< T > a, const UVMap< T > b) |
template<typename T , typename R > | |
UVMap< T > | operator+ (const UVMap< T > a, R c) |
template<typename T , typename R > | |
UVMap< T > | operator+ (const R c, UVMap< T > a) |
template<typename T > | |
UVMap< T > | operator- (const UVMap< T > a, const UVMap< T > b) |
template<typename T , typename R > | |
UVMap< T > | operator- (const UVMap< T > a, R c) |
template<typename T , typename R > | |
UVMap< T > | operator- (const R c, UVMap< T >a) |
template<typename T , typename R > | |
UVMap< T > | operator* (const R d, const UVMap< T > a) |
template<typename T , typename R > | |
UVMap< T > | operator* (const UVMap< T > a, const R d) |
template<typename T , typename R > | |
UVMap< T > | operator/ (const UVMap< T > a, const R d) |
template<typename T , typename R > | |
UVMap< T > | operator/ (const R d, const UVMap< T > a) |
template<typename T > | |
bool | operator== (const UVMap< T > a, const UVMap< T > b) |
template<typename T > | |
bool | operator!= (const UVMap< T > a, const UVMap< T > b) |
void | freeColladaXML (ColladaXML *&xml) |
void | freeFacetBaseData (FacetBaseData *&facet) |
TriPolyData * | dupTriPolyData (TriPolyData *data, int num) |
TriPolyData * | joinTriPolyData (TriPolyData *&first, int num_f, TriPolyData *&next, int num_n) |
void | freeTriPolyData (TriPolyData *&tridata) |
void | freeTriPolyData (TriPolyData *&tridata, int n) |
bool | isSameTexture (TextureParam a, TextureParam b) |
compare texture ma,e and color | |
MaterialParam * | newMaterialParam (MaterialParam p) |
bool | isSameMaterial (MaterialParam a, MaterialParam b) |
compare each texture names and colors | |
void | freeMeshObjectNode (MeshObjectNode *&node) |
void | freeMeshObjectList (MeshObjectNode *&node) |
MeshObjectNode * | DelMeshObjectNode (MeshObjectNode *node) |
MeshObjectNode * | AddMeshObjectNode (MeshObjectNode *list, MeshObjectNode *node) |
void | freeMeshObjectData (MeshObjectData *&data) |
Variables | |
class DllExport | BREP_SOLID |
class DllExport | BREP_SHELL |
class DllExport | BREP_FACET |
class DllExport | BREP_CONTOUR |
class DllExport | BREP_EDGE |
class DllExport | BREP_WING |
class DllExport | BREP_VERTEX |
class DllExport | OctreeNode |
CVFrame * | GLFrame = NULL |
グローバルディスプレイインターフェイス | |
CVDisplay * | GLDisplay = NULL |
グローバルディスプレイインターフェイス | |
CVTextDocument * | GLTextDocument = NULL |
グローバル テキストドキュメント インターフェイス | |
CVCounter * | GLCounter = NULL |
グローバルカウンタ | |
int | ZeroBase = 0 |
int | TempBase = 0 |
class DllExport | Quaternion |
double | Vector_Tolerance = 1.0e-6 |
double | Vertex_Tolerance = 1.0e-6 |
double | Edge_Tolerance = 1.0e-12 |
double | Facet_Tolerance = 1.0e-12 |
double | Abs_Vector_Tolerance = 1.0e-4 |
double | Abs_Vertex_Tolerance = 1.0e-4 |
double | Collision_Tolerance = 1.0e-2 |
衝突判定用トレランス | |
double | Sin_Tolerance = 1.0e-6 |
sinθ==0 | |
double | Zero_Eps = 1.0e-6 |
1に対して 0とするトレランス | |
double | Zero_Eps2 = Zero_Eps*Zero_Eps |
3D Facet用基本データ
typedef std::list<BREP_CONTOUR*> BREP_CONTOUR_LIST |
typedef std::list<BREP_EDGE*> BREP_EDGE_LIST |
typedef std::list<BREP_FACET*> BREP_FACET_LIST |
typedef std::list<BREP_SHELL*> BREP_SHELL_LIST |
typedef std::list<BREP_SOLID*> BREP_SOLID_LIST |
typedef std::list<BREP_VERTEX*> BREP_VERTEX_LIST |
typedef std::list<BREP_WING*> BREP_WING_LIST |
typedef std::vector<FacetTriData> FACET_TRIDATA_ARRAY |
Definition at line 32 of file FacetBaseData.h.
typedef std::vector<FacetTriIndex> FACET_TRIINDX_ARRAY |
Definition at line 31 of file FacetBaseData.h.
typedef std::vector<Vector<double> > FACET_VECTOR_ARRAY |
Definition at line 26 of file FacetBaseData.h.
typedef std::vector<Vector<float> > FACET_VECTOR_ARRAY32 |
Definition at line 30 of file FacetBaseData.h.
MSGraph<T>* jbxl::_getMSGraph_CvMat_C1 | ( | cv::Mat | mat | ) | [inline] |
Definition at line 247 of file OpenCVTool.h.
References MSGraph< T >::color, MSGraph< T >::gp, GRAPH_COLOR_MONO, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
00248 { 00249 MSGraph<T>* vp = NULL; 00250 00251 if (mat.channels()!=1) return NULL; 00252 00253 if (mat.dims==2) { 00254 vp = new MSGraph<T>(mat.cols, mat.rows); 00255 if (vp==NULL || vp->gp==NULL) return vp; 00256 00257 // 通常は連続しているはず 00258 if (mat.isContinuous()) { 00259 R* ptr = (R*)mat.data; 00260 T* dst = vp->gp; 00261 for (int i=0; i<vp->xs*vp->ys; i++) { 00262 dst[i] = (T)ptr[i]; 00263 } 00264 } 00265 else { 00266 for (int j=0; j<vp->ys; j++) { 00267 R* ptr = mat.ptr<R>(j); 00268 T* dst = &(vp->gp[j*vp->xs]); 00269 for (int i=0; i<vp->xs; i++) { 00270 dst[i] = (T)ptr[i]; 00271 } 00272 } 00273 } 00274 // 00275 vp->color = GRAPH_COLOR_MONO; 00276 } 00277 00278 // 3次元 00279 else if (mat.dims==3) { 00280 vp = new MSGraph<T>((int)mat.size[2], (int)mat.size[1], (int)mat.size[0]); 00281 if (vp==NULL || vp->gp==NULL) return vp; 00282 00283 // 通常は連続しているはず 00284 if (mat.isContinuous()) { 00285 R* ptr = (R*)mat.data; 00286 T* dst = vp->gp; 00287 for (int i=0; i<vp->xs*vp->ys*vp->zs; i++) { 00288 dst[i] = (T)ptr[i]; 00289 } 00290 } 00291 else { 00292 for (int k=0; k<vp->zs; k++) { 00293 int kk = k*vp->ys*vp->xs; 00294 for (int j=0; j<vp->ys; j++) { 00295 R* ptr = mat.ptr<R>(k, j); 00296 T* dst = &(vp->gp[j*vp->xs + kk]); 00297 for (int i=0; i<vp->xs; i++) { 00298 dst[i] = (T)ptr[i]; 00299 } 00300 } 00301 } 00302 } 00303 // 00304 vp->color = GRAPH_COLOR_MONO; 00305 } 00306 00307 return vp; 00308 }
MSGraph<T>* jbxl::_getMSGraph_CvMat_C3 | ( | cv::Mat | mat | ) | [inline] |
Definition at line 315 of file OpenCVTool.h.
References _linecopy_MAT2MSG_C3(), MSGraph< T >::color, MSGraph< T >::gp, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
00316 { 00317 MSGraph<T>* vp = NULL; 00318 00319 if (mat.channels()!=3) return NULL; 00320 int tsz = sizeof(T); 00321 00322 if (mat.dims==2) { 00323 vp = new MSGraph<T>(mat.cols, mat.rows); 00324 if (vp==NULL || vp->gp==NULL) return vp; 00325 00326 // 通常は連続しているはず 00327 if (mat.isContinuous()) { 00328 R* src = (R*)mat.data; 00329 T* dst = vp->gp; 00330 vp->color = _linecopy_MAT2MSG_C3(src, dst, vp->xs*vp->ys, tsz); 00331 } 00332 00333 else { 00334 for (int j=0; j<vp->ys; j++) { 00335 R* src = mat.ptr<R>(j); 00336 T* dst = &(vp->gp[j*vp->xs]); 00337 _linecopy_MAT2MSG_C3(src, dst, vp->xs, tsz); 00338 } 00339 vp->color = _linecopy_MAT2MSG_C3((R*)NULL, (T*)NULL, 0, tsz); // return color only 00340 } 00341 } 00342 00343 // 3次元 00344 else if (mat.dims==3) { 00345 vp = new MSGraph<T>((int)mat.size[2], (int)mat.size[1], (int)mat.size[0]); 00346 if (vp==NULL || vp->gp==NULL) return vp; 00347 00348 // 通常は連続しているはず 00349 if (mat.isContinuous()) { 00350 R* src = (R*)mat.data; 00351 T* dst = vp->gp; 00352 vp->color = _linecopy_MAT2MSG_C3(src, dst, vp->xs*vp->ys*vp->zs, tsz); 00353 } 00354 else { 00355 for (int k=0; k<vp->zs; k++) { 00356 int kk = k*vp->ys*vp->xs; 00357 for (int j=0; j<vp->ys; j++) { 00358 R* src = mat.ptr<R>(k, j); 00359 T* dst = &(vp->gp[j*vp->xs + kk]); 00360 for (int i=0; i<vp->xs; i++) { 00361 _linecopy_MAT2MSG_C3(src, dst, vp->xs, tsz); 00362 } 00363 } 00364 } 00365 vp->color = _linecopy_MAT2MSG_C3((R*)NULL, (T*)NULL, 0, tsz); // return color only 00366 } 00367 } 00368 00369 return vp; 00370 }
int jbxl::_linecopy_MAT2MSG_C3 | ( | R * | src, | |
T * | dst, | |||
int | len, | |||
int | sz | |||
) | [inline] |
Definition at line 376 of file OpenCVTool.h.
References ABGR2Int, GRAPH_COLOR_ABGR, GRAPH_COLOR_MONO, GRAPH_COLOR_RGB16, and RGB2Word().
Referenced by _getMSGraph_CvMat_C3().
00377 { 00378 int i3 = 0; 00379 int color = GRAPH_COLOR_MONO; 00380 00381 if (sz==1) { 00382 for (int i=0; i<len; i++) { 00383 dst[i] = (T)(((unsigned int)src[i3] + (unsigned int)src[i3+1] + (unsigned int)src[i3+2])/3); 00384 i3 += 3; 00385 } 00386 } 00387 00388 else if (sz==2) { 00389 for (int i=0; i<len; i++) { 00390 dst[i] = (T)RGB2Word((unsigned int)src[i3+2], (unsigned int)src[i3+1], (unsigned int)src[i3]); 00391 i3 += 3; 00392 } 00393 color = GRAPH_COLOR_RGB16; 00394 } 00395 00396 else { 00397 for (int i=0; i<len; i++) { 00398 dst[i] = (T)ABGR2Int(0, (unsigned int)src[i3], (unsigned int)src[i3+1], (unsigned int)src[i3+2]); 00399 i3 += 3; 00400 } 00401 color = GRAPH_COLOR_ABGR; 00402 } 00403 00404 return color; 00405 }
非推奨 use get_local_timestamp(time(0), "%Y-%m-%dT%H:%M:%SZ")); need free()
inline char* GetLocalTime(char deli1='-', char deli2='T', char deli3=':', char deli4='Z') ///< not free() { return get_localtime(deli1, deli2, deli3, deli4); }
Definition at line 76 of file tools++.h.
References add_tList_node_bystr().
00077 { 00078 T* pp = new T(); 00079 *pp = obj; 00080 lt = add_tList_node_bystr(lt, 0, 0, NULL, NULL, (void*)pp, sizeof(T)); 00081 00082 return lt; 00083 }
MeshObjectNode * AddMeshObjectNode | ( | MeshObjectNode * | list, | |
MeshObjectNode * | node | |||
) |
Definition at line 409 of file MeshObjectData.cpp.
References MeshObjectNode::next, and MeshObjectNode::prev.
Referenced by MeshObjectData::addNode().
00410 { 00411 if (list==NULL) return node; 00412 if (node==NULL) return list; 00413 00414 node->prev = list; 00415 node->next = list->next; 00416 00417 if (list->next!=NULL) list->next->prev = node; 00418 list->next = node; 00419 00420 return node; 00421 }
int jbxl::addPaint_MSGraph | ( | MSGraph< T > | xp, | |
int | x, | |||
int | y, | |||
int | mn, | |||
int | mx, | |||
int | add, | |||
int | mode = 8 | |||
) | [inline] |
template <typename t>=""> int addPaint_MSGraph(MSGraph<T> xp, int x, int y, int mn, int mx, int add, int mode=8)
追加式の 2Dペイント
xp の (x, y)座標から,輝度値 mn〜mx の範囲の点に addを加える.
xp | グラフィックデータ構造体. | |
x | 塗りつぶしを始める点の X座標. | |
y | 塗りつぶしを始める点の Y座標. | |
mn | 塗りつぶされる輝度値の最小値 | |
mx | 塗りつぶされる輝度値の最大値. | |
add | 加える輝度値.マイナスでも動作するが,作業領域に注意. | |
mode | モード.8以上:平面上で 8近傍の塗りつぶし その他:平面上で 4近傍の塗りつぶし |
Definition at line 2254 of file Graph.h.
References MSGraph< T >::point(), MSGraph< T >::xs, and MSGraph< T >::ys.
Referenced by delete_noise_MSGraph().
02255 { 02256 int i, k, cc, cx, st, ed, num=0; 02257 02258 if (x<0 || x>=xp.xs || y<0 || y>=xp.ys) return 0; 02259 02260 // 左端へ 02261 cc = (int)xp.point(x, y); 02262 while(x>0) { 02263 cx = (int)xp.point(x-1, y); 02264 if (cx>mx || cx<mn) break; 02265 cc = cx; 02266 x--; 02267 } 02268 st = k = x; 02269 02270 // 右方向へ塗りつぶし 02271 while(k<xp.xs) { 02272 cx = (int)xp.point(k, y); 02273 if (cx>mx || cx<mn) break; 02274 xp.point(k, y) += add; 02275 cc = cx; 02276 num++; 02277 k++; 02278 } 02279 ed = k - 1; 02280 02281 // 上下ライン 02282 for (i=st; i<=ed; i++){ 02283 cc = (int)xp.point(i, y) - add; 02284 02285 // 1ライン上へ 02286 if (y-1>=0 && y-1<xp.ys){ 02287 cx = (int)xp.point(i, y-1); 02288 if (cx<=mx && cx>=mn) { 02289 num += addPaint_MSGraph(xp, i, y-1, mn, mx, add, mode); 02290 } 02291 if (mode>=8) { 02292 if (i-1>=0) { 02293 cx = (int)xp.point(i-1, y-1); 02294 if (cx<=mx && cx>=mn) { 02295 num += addPaint_MSGraph(xp, i-1, y-1, mn, mx, add, mode); 02296 } 02297 } 02298 if (i+1<xp.xs) { 02299 cx = (int)xp.point(i+1, y-1); 02300 if (cx<=mx && cx>=mn) { 02301 num += addPaint_MSGraph(xp, i+1, y-1, mn, mx, add, mode); 02302 } 02303 } 02304 } 02305 } 02306 02307 // 1ライン下へ 02308 if (y+1>=0 && y+1<xp.ys){ 02309 cx = (int)xp.point(i, y+1); 02310 if (cx<=mx && cx>=mn) { 02311 num += addPaint_MSGraph(xp, i, y+1, mn, mx, add, mode); 02312 } 02313 if (mode>=8) { 02314 if (i-1>=0) { 02315 cx = (int)xp.point(i-1, y+1); 02316 if (cx<=mx && cx>=mn) { 02317 num += addPaint_MSGraph(xp, i-1, y+1, mn, mx, add, mode); 02318 } 02319 } 02320 if (i+1<xp.xs) { 02321 cx = (int)xp.point(i+1, y+1); 02322 if (cx<=mx && cx>=mn) { 02323 num += addPaint_MSGraph(xp, i+1, y+1, mn, mx, add, mode); 02324 } 02325 } 02326 } 02327 } 02328 } 02329 02330 return num; 02331 }
DllExport void AddVector2TriSolid | ( | BREP_SOLID * | solid, | |
BREP_SHELL * | shell, | |||
Vector< double > * | vect, | |||
Vector< double > * | nrml = NULL , |
|||
UVMap< double > * | uvmp = NULL , |
|||
bool | dupli = false | |||
) |
vect[3]を BREP_SOLIDに1個ずつシーケンシャルに追加する. データの追加が終わったら,必ず CloseSolid() を呼ぶこと.
カウンタは無し.外部で利用すること.
solid | ソリッドデータへのポインタ | |
shell | シェルデータへのポインタ | |
vect | 3個の頂点データ vect[3] へのポインタ | |
nrml | 頂点の法線ベクトルデータへのポインタ. | |
uvmp | 頂点の曲面座標データへのポインタ. | |
dupli | true: 頂点の重複登録を許可する.false: 重複登録を許可しない. |
Definition at line 1436 of file TriBrep.cpp.
References BREP_FACET, BREP_SOLID::contours, CreateContourByVector(), deleteNull(), and BREP_SOLID::octree.
01437 { 01438 BREP_FACET* facet; 01439 BREP_CONTOUR* contour; 01440 01441 if (solid==NULL || shell==NULL || vect==NULL) return; 01442 if (solid->octree==NULL) return; 01443 01444 facet = new BREP_FACET(shell); 01445 contour = CreateContourByVector(facet, vect, nrml, uvmp, dupli); 01446 if (contour!=NULL) { 01447 /* 01448 if (check) { 01449 // 衝突判定 01450 BREP_CONTOUR* collision; 01451 facet->CloseData(); 01452 if (!IsCollisionContours(solid, contour, &collision)) { 01453 solid->contours.push_back(contour); // IsCollisionContours()用 01454 } 01455 else { 01456 collision->facet->deletable = true; // 衝突相手も消す. 01457 FastDeleteFacet(facet); 01458 } 01459 } 01460 else solid->contours.push_back(contour); 01461 */ 01462 solid->contours.push_back(contour); 01463 } 01464 else { 01465 deleteNull(facet); 01466 } 01467 01468 return; 01469 }
DllExport BREP_VERTEX * AddVertex2Octree | ( | BREP_VERTEX * | vert, | |
OctreeNode * | octree, | |||
bool | dupli = false | |||
) |
BREP_VERTEX* jbxl::AddVertex2Octree(BREP_VERTEX* vert, OctreeNode* octree, bool dupli)
Vertex vert を octreeに登録する.
dupli がfalseの場合:
既に同じ位置に Vertexが登録されている場合(UVマップも比べる)は,vertは消去されて,既に登録されている Vertexが返される.
この関数を使用後は vertを使用してはいけない(deleteされている可能性があるので)
dupli が trueの場合:
既に同じ位置に Vertexが登録されていても,重複して登録する.
vert | 登録する頂点データ | |
octree | 頂点データを格納するオクトツリー | |
dupli | true: 頂点の重複登録を許可する.false: 重複登録を許可しない. |
vert = AddVertex2Octree(vert, octree, false);
Definition at line 1019 of file Brep.cpp.
References OctreeNode::AddWithDuplicates(), OctreeNode::AddWithUnique(), OctreeNode::solid, OctreeNode::vertex, and BREP_SOLID::vertexno.
Referenced by CreateContourByVector().
01020 { 01021 OctreeNode* node; 01022 01023 if (dupli) node = octree->AddWithDuplicates(vert); 01024 else node = octree->AddWithUnique(vert); 01025 if (node==NULL) return NULL; 01026 01027 if (node->vertex==vert) { 01028 octree->solid->vertexno++; // Vertexを新規登録したのでカウントする. 01029 } 01030 return node->vertex; 01031 }
unsigned int jbxl::ARGB2Int | ( | unsigned int | a, | |
unsigned int | r, | |||
unsigned int | g, | |||
unsigned int | b | |||
) | [inline] |
Definition at line 1016 of file Gdata.h.
References isBigEndian.
01017 { 01018 if (isBigEndian) { // A-R-G-B 01019 a = (unsigned int)((a&0x000000ff)<<24); 01020 r = (unsigned int)((r&0x000000ff)<<16); 01021 g = (unsigned int)((g&0x000000ff)<<8); 01022 b = (unsigned int) (b&0x000000ff); 01023 } 01024 else { // B-G-R-A 01025 b = (unsigned int)((b&0x000000ff)<<24); 01026 g = (unsigned int)((g&0x000000ff)<<16); 01027 r = (unsigned int)((r&0x000000ff)<<8); 01028 a = (unsigned int) (a&0x000000ff); 01029 } 01030 01031 unsigned int c = (unsigned int)(a + r + g + b); 01032 return c; 01033 }
Definition at line 1041 of file Gdata.h.
References isBigEndian.
01042 { 01043 if (isBigEndian) { // A-R-G-B 01044 a = (int)(((a&0x00ff)>>4)<<12); 01045 r = (int)(((r&0x00ff)>>4)<<8); 01046 g = (int)(((g&0x00ff)>>4)<<4); 01047 b = (int) ((b&0x00ff)>>4); 01048 } 01049 else { // G-B A-R 01050 g = (int)(((g&0x00ff)>>4)<<12); 01051 b = (int)(((b&0x00ff)>>4)<<8); 01052 a = (int)(((a&0x00ff)>>4)<<4); 01053 r = (int) ((r&0x00ff)>>4); 01054 } 01055 01056 uWord c = (uWord)(a + r + g + b); 01057 return c; 01058 }
Vector<T> jbxl::BSplineInterp4 | ( | Vector< T > | p0, | |
Vector< T > | p1, | |||
double | t | |||
) | [inline] |
4階(3次)Bスプライン曲線補間. 2次の導関数が両端で 0の条件有り.
P(t) = 1/6*(1-t)^3*Q0 + (1/2*t^3 - t^2 + 2/3)*Q1 + (-1/2*t^3 + 1/2*t^2 + 1/2*t + 1/6)*Q2 + 1/6*t^3*Q3 Q0 = 2*P(0) - P(1); Q1 = P(0) Q2 = P(1) Q3 = 2*P(1) - P(0)
Definition at line 324 of file Vector.h.
00325 { 00326 Vector<T> q0 = 2*p0 - p1; 00327 // Vector<T> q1 = p0; 00328 // Vector<T> q2 = p1; 00329 Vector<T> q3 = 2*p1 - p0; 00330 00331 double t2 = t*t; 00332 double t3 = t2*t; 00333 00334 double c0 = (t2 - t)*0.5 + (1.0 - t3)*0.1666666666666667; // 1/6*(1-t)^3 00335 double c1 = t3*0.5 - t2 + 0.6666666666666667; // 1/2*t3 - t2 + 2/3 00336 double c2 = (t + t2 - t3)*0.5 + 0.1666666666666667; // -1/2*t3 + 1/2*t2 + 1/2*t + 1/6 00337 double c3 = t3*0.1666666666666667; // 1/6*t3 00338 00339 Vector<T> vect = c0*q0 + c1*p0 + c2*p1 + c3*q3; 00340 00341 return vect; 00342 }
void jbxl::cat_MSGraph | ( | MSGraph< R > * | src, | |
MSGraph< T > * | dst | |||
) | [inline] |
template <typename T, typename R> void cat_MSGraph(MSGraph<R>* src, MSGraph<T>* dst)
MSGraph<R>型データのバッファ部を MSGraph<T>型のバッファ部へ上書き(追加)する.
位置,サイズは自動調整される.
src | コピー元グラフィックデータ | |
dst | コピー先グラフィックデータ |
Definition at line 489 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::free(), MSGraph< T >::gp, MSGraph< T >::max, Max, MSGraph< T >::min, Min, MSGraph< T >::rbound, MSGraph< T >::RZxy, MSGraph< T >::set(), RBound< T >::xmax, RBound< T >::xmin, MSGraph< T >::xs, RBound< T >::ymax, RBound< T >::ymin, MSGraph< T >::ys, MSGraph< T >::zero, RBound< T >::zmax, RBound< T >::zmin, and MSGraph< T >::zs.
00490 { 00491 if (src==NULL || dst==NULL) return; 00492 if ((void*)src->gp==(void*)dst->gp) return; 00493 00494 int i, x, y, z; 00495 MSGraph<T> vp; 00496 RBound<int> rb; 00497 00498 rb.xmin = Min(src->rbound.xmin, dst->rbound.xmin); 00499 rb.ymin = Min(src->rbound.ymin, dst->rbound.ymin); 00500 rb.zmin = Min(src->rbound.zmin, dst->rbound.zmin); 00501 rb.xmax = Max(src->rbound.xmax, dst->rbound.xmax); 00502 rb.ymax = Max(src->rbound.ymax, dst->rbound.ymax); 00503 rb.zmax = Max(src->rbound.zmax, dst->rbound.zmax); 00504 00505 vp.set(rb.xmax-rb.xmin+1, rb.ymax-rb.ymin+1, rb.zmax-rb.zmin+1, dst->zero, dst->base, dst->RZxy); 00506 if (vp.gp==NULL) return; 00507 vp.rbound = rb; 00508 vp.max = Max((T)src->max, dst->max); 00509 vp.min = Min((T)src->min, dst->min); 00510 00511 for (i=0; i<dst->xs*dst->ys*dst->zs; i++) { 00512 if (dst->gp[i]!=dst->zero) { 00513 x = i%dst->xs + dst->rbound.xmin - rb.xmin; 00514 y = (i/dst->xs)%dst->ys + dst->rbound.ymin - rb.ymin; 00515 z = i/(dst->xs*dst->ys) + dst->rbound.zmin - rb.zmin; 00516 vp.gp[z*vp.xs*vp.ys + y*vp.xs + x] = dst->gp[i]; 00517 } 00518 } 00519 00520 for (i=0; i<src->xs*src->ys*src->zs; i++) { 00521 if (src->gp[i]!=src->zero) { 00522 x = i%src->xs + src->rbound.xmin - rb.xmin; 00523 y = (i/src->xs)%src->ys + src->rbound.ymin - rb.ymin; 00524 z = i/(src->xs*src->ys) + src->rbound.zmin - rb.zmin; 00525 vp.gp[z*vp.xs*vp.ys + y*vp.xs + x] = (T)src->gp[i]; 00526 } 00527 } 00528 00529 dst->free(); 00530 *dst = vp; 00531 return; 00532 }
void jbxl::cat_MSGraph | ( | MSGraph< R > | src, | |
MSGraph< T > & | dst | |||
) | [inline] |
template <typename T, typename R> void cat_MSGraph(MSGraph<R> src, MSGraph<T>& dst)
MSGraph<R>型データのバッファ部を MSGraph<T>型のバッファ部へ上書き(追加)する.
位置,サイズは自動調整される.
src | コピー元グラフィックデータ | |
dst | コピー先グラフィックデータ |
Definition at line 434 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::free(), MSGraph< T >::gp, MSGraph< T >::max, Max, MSGraph< T >::min, Min, MSGraph< T >::rbound, MSGraph< T >::RZxy, MSGraph< T >::set(), RBound< T >::xmax, RBound< T >::xmin, MSGraph< T >::xs, RBound< T >::ymax, RBound< T >::ymin, MSGraph< T >::ys, MSGraph< T >::zero, RBound< T >::zmax, RBound< T >::zmin, and MSGraph< T >::zs.
00435 { 00436 if ((void*)src.gp==(void*)dst.gp) return; 00437 00438 int i, x, y, z; 00439 MSGraph<T> vp; 00440 RBound<int> rb; 00441 00442 rb.xmin = Min(src.rbound.xmin, dst.rbound.xmin); 00443 rb.ymin = Min(src.rbound.ymin, dst.rbound.ymin); 00444 rb.zmin = Min(src.rbound.zmin, dst.rbound.zmin); 00445 rb.xmax = Max(src.rbound.xmax, dst.rbound.xmax); 00446 rb.ymax = Max(src.rbound.ymax, dst.rbound.ymax); 00447 rb.zmax = Max(src.rbound.zmax, dst.rbound.zmax); 00448 00449 vp.set(rb.xmax-rb.xmin+1, rb.ymax-rb.ymin+1, rb.zmax-rb.zmin+1, dst.zero, dst.base, dst.RZxy); 00450 if (vp.gp==NULL) return; 00451 vp.rbound = rb; 00452 vp.max = Max((T)src.max, dst.max); 00453 vp.min = Min((T)src.min, dst.min); 00454 00455 for (i=0; i<dst.xs*dst.ys*dst.zs; i++) { 00456 if (dst.gp[i]!=dst.zero) { 00457 x = i%dst.xs + dst.rbound.xmin - rb.xmin; 00458 y = (i/dst.xs)%dst.ys + dst.rbound.ymin - rb.ymin; 00459 z = i/(dst.xs*dst.ys) + dst.rbound.zmin - rb.zmin; 00460 vp.gp[z*vp.xs*vp.ys + y*vp.xs + x] = dst.gp[i]; 00461 } 00462 } 00463 00464 for (i=0; i<src.xs*src.ys*src.zs; i++) { 00465 if (src.gp[i]!=src.zero) { 00466 x = i%src.xs + src.rbound.xmin - rb.xmin; 00467 y = (i/src.xs)%src.ys + src.rbound.ymin - rb.ymin; 00468 z = i/(src.xs*src.ys) + src.rbound.zmin - rb.zmin; 00469 vp.gp[z*vp.xs*vp.ys + y*vp.xs + x] = (T)src.gp[i]; 00470 } 00471 } 00472 00473 dst.free(); 00474 dst = vp; 00475 return; 00476 }
MSGraph<T> jbxl::centerLine | ( | MSGraph< T > | gx, | |
int | mode | |||
) | [inline] |
template <typename t>=""> MSGraph<T> centerLine(MSGraph<T> gx, int mode)
3D画像に対して,連結数に基づいた細線化を行う.
gx | 3D画像. | |
mode | 26: 26近傍,その他: 6近傍 |
Definition at line 45 of file Thinning.h.
References add_tList_node_bydata(), del_tList_node(), deletable(), euclidDistance(), MSGraph< T >::free(), MSGraph< T >::gp, init_tList_data(), Max, Min, new_tList_node(), nonZeroBoxel(), SINTMAX, MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00046 { 00047 int i, j, k, l, m, n, w, b, nn, mm; 00048 int rr, dd, xs, ps; 00049 00050 bool dt; 00051 00052 MSGraph<int> gd; 00053 MSGraph<T> vp; 00054 tList *pp, *px; 00055 tList_data ld; 00056 00057 if (mode!=26) mode = 6; 00058 xs = gx.xs; 00059 ps = gx.xs*gx.ys; 00060 ld = init_tList_data(); 00061 00062 // STEP 1 00063 //DEBUG_Warning("center_line: start step1"); 00064 gd = euclidDistance(gx, gd.zero+1, rr); 00065 00066 dd = SINTMAX; 00067 rr = 0; 00068 for (i=0; i<gd.xs*gd.ys*gd.zs; i++) { 00069 if (gd.gp[i]!=0) { 00070 gd.gp[i] += 20; 00071 dd = Min(dd, gd.gp[i]); 00072 rr = Max(rr, gd.gp[i]); 00073 } 00074 } 00075 00076 // STEP 2 00077 //DEBUG_Warning("center_line: start step2"); 00078 pp = px = new_tList_node(); 00079 00080 for (k=1; k<gd.zs-1; k++) { 00081 l = k*ps; 00082 for (j=1; j<gd.ys-1; j++) { 00083 m = l + j*xs; 00084 for (i=1; i<gd.xs-1; i++) { 00085 n = m + i; 00086 if (gd.gp[n]>20) { 00087 w = gd.gp[n+1]*gd.gp[n-1]*gd.gp[n+xs]*gd.gp[n-xs] 00088 *gd.gp[n+ps]*gd.gp[n-ps]; 00089 if(w==0) { 00090 ld.id = n; 00091 ld.lv = (int)gd.gp[n]; 00092 px = add_tList_node_bydata(px, ld); 00093 gd.gp[n] = 1; 00094 } 00095 } 00096 } 00097 } 00098 } 00099 00100 //DEBUG_Warning("center_line: start step3, step4 and step5"); 00101 do { 00102 // STEP 3 00103 //DEBUG_Warning("center_line: start step3"); 00104 px = pp->next; 00105 while(px!=NULL) { 00106 if (px->ldat.lv<=dd) { 00107 dt = deletable(gd, px->ldat.id, mode, 3); 00108 if (dt) { 00109 m = nonZeroBoxel(gd, px->ldat.id); 00110 if (m==1) { 00111 tList* pv = px->prev; 00112 del_tList_node(&px); 00113 px = pv; 00114 } 00115 else px->ldat.lv = m/3 + 7; 00116 } 00117 else { 00118 px->ldat.lv = 16; 00119 } 00120 } 00121 px = px->next; 00122 } 00123 00124 // STEP 4 00125 //DEBUG_Warning("center_line: start step4"); 00126 for (b=7; b<=15; b++) { 00127 px = pp->next; 00128 while(px!=NULL) { 00129 if (px->ldat.lv==b) { 00130 dt = deletable(gd, px->ldat.id, mode, 3); 00131 if (dt) { 00132 m = nonZeroBoxel(gd, px->ldat.id); 00133 if (m==1) { 00134 tList* pv = px->prev; 00135 del_tList_node(&px); 00136 px = pv; 00137 } 00138 else { 00139 i = px->ldat.id; 00140 gd.gp[i] = 0; 00141 00142 tList* pv = px->prev; 00143 del_tList_node(&px); 00144 px = pv; 00145 00146 if (gd.gp[i+1]>20) { 00147 ld.id = i+1; 00148 ld.lv = (int)gd.gp[ld.id]; 00149 px = add_tList_node_bydata(px, ld); 00150 gd.gp[ld.id] = 1; 00151 } 00152 if (gd.gp[i-1]>20) { 00153 ld.id = i-1; 00154 ld.lv = (int)gd.gp[ld.id]; 00155 px = add_tList_node_bydata(px, ld); 00156 gd.gp[ld.id] = 1; 00157 } 00158 if (gd.gp[i+xs]>20) { 00159 ld.id = i+xs; 00160 ld.lv = (int)gd.gp[ld.id]; 00161 px = add_tList_node_bydata(px, ld); 00162 gd.gp[ld.id] = 1; 00163 } 00164 if (gd.gp[i-xs]>20) { 00165 ld.id = i-xs; 00166 ld.lv = (int)gd.gp[ld.id]; 00167 px = add_tList_node_bydata(px, ld); 00168 gd.gp[ld.id] = 1; 00169 } 00170 if (gd.gp[i+ps]>20) { 00171 ld.id = i+ps; 00172 ld.lv = (int)gd.gp[ld.id]; 00173 px = add_tList_node_bydata(px, ld); 00174 gd.gp[ld.id] = 1; 00175 } 00176 if (gd.gp[i-ps]>20) { 00177 ld.id = i-ps; 00178 ld.lv = (int)gd.gp[ld.id]; 00179 px = add_tList_node_bydata(px, ld); 00180 gd.gp[ld.id] = 1; 00181 } 00182 } 00183 } 00184 else { 00185 px->ldat.lv = 16; 00186 } 00187 } 00188 px = px->next; 00189 } 00190 } 00191 00192 // STEP 5 00193 //DEBUG_Warning("center_line: start step5"); 00194 dd = rr; 00195 px = pp->next; 00196 while(px!=NULL) { 00197 if (px->ldat.lv>20) { 00198 dd = Min(dd, px->ldat.lv); 00199 } 00200 px = px->next; 00201 } 00202 mm = nn = 0; 00203 px = pp->next; 00204 while(px!=NULL) { 00205 nn++; 00206 if (px->ldat.lv==16) mm++; 00207 px = px->next; 00208 } 00209 00210 } while (dd<rr || mm!=nn); 00211 00212 vp.setup(gd.xs, gd.ys, gd.zs); 00213 for (i=0; i<gd.xs*gd.ys*gd.zs; i++) vp.gp[i] = (T)gd.gp[i]; 00214 gd.free(); 00215 00216 return vp; 00217 }
MSGraph<T> jbxl::CenterLine | ( | MSGraph< T > | gx, | |
int | mode | |||
) | [inline] |
void jbxl::ClearGlobalCounter | ( | ) | [inline] |
void jbxl::ClearGlobalDisplay | ( | ) | [inline] |
void jbxl::ClearGlobalFrame | ( | ) | [inline] |
void jbxl::ClearGlobalTextDocument | ( | ) | [inline] |
Definition at line 122 of file ClassBox.h.
References GLTextDocument.
00122 { GLTextDocument = NULL;}
DllExport int CloseTriSolid | ( | BREP_SOLID * | solid, | |
bool | check = true , |
|||
CVCounter * | counter = NULL | |||
) |
int jbxl::CloseTriSolid(BREP_SOLID* solid, bool check, CVCounter* counter)
AddVector2TriSolid() の最後に呼んで,データをクローズする. BREP_SOLIDに使用された有効なファセットの数を返す.
solid | ソリッドデータへのポインタ | |
check | データのエラーチェックを行うか? 行う場合,不正データは削除される. | |
counter | 仮想カウンタ. |
-1 | ソリッドがNULL |
Definition at line 1484 of file TriBrep.cpp.
References BREP_SOLID::CloseData(), BREP_SOLID::contours, CreateContoursList(), CreateShortageWingsList(), CreateSurplusContoursList(), CreateWingsList(), CVCounter::DeleteChildCounter(), DeleteStraightEdges(), DeleteSurplusContours(), CVCounter::MakeChildCounter(), and BREP_SOLID::vcount.
Referenced by BrepSolidList::addSolid(), CreateTriSolidFromSTL(), CreateTriSolidFromVector(), and BrepSolidList::getMerge().
01485 { 01486 if (solid==NULL) return -1; 01487 01488 // deletableになっているContourがあるかもしれないので,CreateContoursList()で作り直し. 01489 CreateContoursList(solid); 01490 CreateWingsList(solid); 01491 01492 if (check) { 01493 // 多重Edgeの削除 01494 CreateSurplusContoursList(solid); 01495 if (counter!=NULL) counter->MakeChildCounter(10); 01496 DeleteSurplusContours(solid); 01497 if (counter!=NULL) counter->DeleteChildCounter(); 01498 // 直線に並んだ Edgeの削除 01499 CreateShortageWingsList(solid); 01500 if (counter!=NULL) counter->MakeChildCounter(10); 01501 DeleteStraightEdges(solid); 01502 if (counter!=NULL) counter->DeleteChildCounter(); 01503 } 01504 01505 CreateSurplusContoursList(solid); // 作り直し 01506 CreateShortageWingsList(solid); 01507 solid->vcount = 3; // for Triangle Facet 01508 solid->CloseData(); // Close Octree 01509 // 01510 return (int)solid->contours.size(); 01511 }
Definition at line 39 of file Gdata.h.
References CmnHead::grptr, CmnHead::xsize, and CmnHead::ysize.
DllExport bool CollisionTriContour2D | ( | BREP_CONTOUR * | contour1, | |
BREP_CONTOUR * | contour2 | |||
) |
Definition at line 1075 of file TriBrep.cpp.
References Collision_Tolerance, BREP_CONTOUR::directR, BREP_CONTOUR::directRS, BREP_CONTOUR::directS, Max, BREP_WING::next, Vector< T >::norm(), ProportionVector(), TVectorMultiTolerance(), BREP_WING::vertex, Vertex2TVector(), BREP_CONTOUR::wing, Xabs, and Zero_Eps.
Referenced by IsCollisionContours().
01076 { 01077 double uc, vc, tm, um, ut, vt, tmt, umt; 01078 BREP_WING* wing = contour1->wing; 01079 TVector<double> directR = contour2->directR; 01080 TVector<double> directS = contour2->directS; 01081 TVector<double> directRS = contour2->directRS; 01082 01083 wing = contour1->wing; 01084 for (int i=0; i<3; i++) { 01085 TVector<double> point = Vertex2TVector(wing->vertex); 01086 TVector<double> directB = Vertex2TVector(wing->next->vertex) - point; 01087 TVector<double> directQ = Vertex2TVector(contour2->wing->vertex) - point; 01088 TVector<double> directQB = directQ^directB; 01089 directB.norm(); 01090 01091 tm = directQB*directS; 01092 um = directRS*directB; 01093 tmt = TVectorMultiTolerance(directQB, directS); 01094 umt = TVectorMultiTolerance(directRS, directB); 01095 01096 if (Xabs(tm)<=Max(tmt, Zero_Eps) || Xabs(um)<=Max(umt, Zero_Eps)) { 01097 TVector<double> directBR = directB^directR; 01098 TVector<double> directQR = directQ^directR; 01099 TVector<double> directQB = directQ^directB; 01100 uc = ProportionVector(directQB, directBR, ut); 01101 vc = ProportionVector(directQR, directBR, vt); 01102 ut = Max(ut, Collision_Tolerance); 01103 vt = Max(vt, Collision_Tolerance); 01104 if (uc>ut && 1.-uc>ut && vc>vt && 1.-vc>vt && 01105 uc*directR.n>directR.t && (1.-uc)*directR.n>directR.t && 01106 vc*directB.n>directB.t && (1.-vc)*directB.n>directB.t) { 01107 // DEBUG_MODE PRINT_MESG("同一平面上1 %e %e %e %e\n", uc, vc, ut, vt); 01108 // PrintFacetAsciiSTL(contour1); 01109 // PrintFacetAsciiSTL(contour2); 01110 return true; 01111 } 01112 01113 directBR = directB^directS; 01114 directQR = (directQ+directR)^directS; 01115 directQB = (directQ+directR)^directB; 01116 uc = ProportionVector(directQB, directBR, ut); 01117 vc = ProportionVector(directQR, directBR, vt); 01118 ut = Max(ut, Collision_Tolerance); 01119 vt = Max(vt, Collision_Tolerance); 01120 if (uc>ut && 1.-uc>ut && vc>vt && 1.-vc>vt && 01121 uc*directS.n>directS.t && (1.-uc)*directS.n>directS.t && 01122 vc*directB.n>directB.t && (1.-vc)*directB.n>directB.t) { 01123 // DEBUG_MODE PRINT_MESG("同一平面上2 %e %e %e %e\n", uc, vc, ut, vt); 01124 // PrintFacetAsciiSTL(contour1); 01125 // PrintFacetAsciiSTL(contour2); 01126 return true; 01127 } 01128 01129 TVector<double> directT = directR + directS; 01130 directBR = directB^directT; 01131 directQR = directQ^directT; 01132 directQB = directQ^directB; 01133 uc = ProportionVector(directQB, directBR, ut); 01134 vc = ProportionVector(directQR, directBR, vt); 01135 ut = Max(ut, Collision_Tolerance); 01136 vt = Max(vt, Collision_Tolerance); 01137 if (uc>ut && 1.-uc>ut && vc>vt && 1.-vc>vt && 01138 uc*directT.n>directT.t && (1.-uc)*directT.n>directT.t && 01139 vc*directB.n>directB.t && (1.-vc)*directB.n>directB.t) { 01140 // DEBUG_MODE PRINT_MESG("同一平面上3 %e %e %e %e\n", uc, vc, ut, vt); 01141 // PrintFacetAsciiSTL(contour1); 01142 // PrintFacetAsciiSTL(contour2); 01143 return true; 01144 } 01145 } 01146 01147 wing = wing->next; 01148 } 01149 01150 return false; 01151 }
DllExport bool CollisionTriContour3D | ( | BREP_CONTOUR * | contour1, | |
BREP_CONTOUR * | contour2 | |||
) |
bool jbxl::CollisionTriContour3D(BREP_CONTOUR* contour1, BREP_CONTOUR* contour2)
contour1と contour2が衝突しているかどうかをチェックする.
contour2->directRS, directR, directS が予め計算されていなければならない.→例えば ComputeDirectRS() を使用
Definition at line 1012 of file TriBrep.cpp.
References Collision_Tolerance, BREP_CONTOUR::directR, BREP_CONTOUR::directRS, BREP_CONTOUR::directS, Max, Vector< T >::n, BREP_WING::next, TVector< T >::t, TVectorMultiTolerance(), BREP_WING::vertex, Vertex2TVector(), BREP_CONTOUR::wing, Xabs, and Zero_Eps.
Referenced by IsCollisionContours().
01013 { 01014 double tc, uc, vc, tm, um, ut, vt, tt, tmt, umt; 01015 BREP_WING* wing = contour1->wing; 01016 TVector<double> directR = contour2->directR; 01017 TVector<double> directS = contour2->directS; 01018 TVector<double> directRS = contour2->directRS; 01019 TVector<double> directT; 01020 TVector<double> directB; 01021 TVector<double> directQB; 01022 TVector<double> directN; 01023 01024 // 各辺による衝突検出 01025 for (int i=0; i<3; i++) { 01026 TVector<double> point = Vertex2TVector(wing->vertex); 01027 TVector<double> directQ = Vertex2TVector(contour2->wing->vertex) - point; 01028 01029 for (int j=0; j<2; j++) { 01030 directN = Vertex2TVector(wing->next->vertex); 01031 if (j==0) directB = directN - point; 01032 else directB = directB + (Vertex2TVector(wing->next->next->vertex) - directN)*0.5; 01033 directQB = directQ^directB; 01034 01035 um = directRS*directB; 01036 tm = directQB*directS; 01037 umt = TVectorMultiTolerance(directRS, directB); 01038 tmt = TVectorMultiTolerance(directQB, directS); 01039 01040 if (Xabs(um)>Max(umt, Zero_Eps) && Xabs(tm)>Max(tmt, Zero_Eps)) { 01041 uc = tm; 01042 tc = -directQB*directR; 01043 vc = directRS*directQ; 01044 ut = tmt; 01045 tt = TVectorMultiTolerance(directQB, directR); 01046 vt = TVectorMultiTolerance(directRS, directQ); 01047 01048 ut = Max(Collision_Tolerance, (um*ut+umt*uc)/(um*um)); 01049 tt = Max(Collision_Tolerance, (tm*tt+tmt*tc)/(tm*tm)); 01050 vt = Max(Collision_Tolerance, (um*vt+umt*vc)/(um*um)); 01051 uc = uc/um; 01052 tc = tc/tm; 01053 vc = vc/um; 01054 directT = directR + tc*directS; 01055 01056 if (uc>ut && 1.-uc>ut && tc>tt && 1.-tc>tt && vc>vt && 1.-vc>vt && 01057 uc*directT.n>directT.t && (1.-uc)*directT.n>directT.t && 01058 tc*directS.n>directS.t && (1.-tc)*directS.n>directS.t && 01059 vc*directB.n>directB.t && (1.-vc)*directB.n>directB.t) { 01060 // DEBUG_MODE PRINT_MESG("3D衝突 %d !!!! %e %e %e\n", j+1, uc, tc, vc); 01061 // PrintFacetAsciiSTL(contour1); 01062 // PrintFacetAsciiSTL(contour2); 01063 return true; 01064 } 01065 } 01066 } 01067 wing = wing->next; 01068 } 01069 01070 return false; 01071 }
DllExport int CommonVertex | ( | BREP_CONTOUR * | contour1, | |
BREP_CONTOUR * | contour2 | |||
) |
Definition at line 1216 of file TriBrep.cpp.
References BREP_WING::next, BREP_WING::vertex, and BREP_CONTOUR::wing.
Referenced by IsCollisionContours().
01217 { 01218 BREP_VERTEX_LIST vertex_list; 01219 01220 int cnt = 0; 01221 BREP_WING* wing1 = contour1->wing; 01222 for (int i=0; i<3; i++) { 01223 bool common = false; 01224 BREP_WING* wing2 = contour2->wing; 01225 for (int j=0; j<3; j++) { 01226 if (wing1->vertex==wing2->vertex) { 01227 cnt++; 01228 common = true; 01229 break; 01230 } 01231 wing2 = wing2->next; 01232 } 01233 if (!common) vertex_list.push_back(wing1->vertex); 01234 wing1 = wing1->next; 01235 } 01236 return cnt; 01237 }
DllExport int CompareVertex | ( | BREP_VERTEX * | v1, | |
BREP_VERTEX * | v2 | |||
) |
int jbxl::CompareVertex(BREP_VERTEX* v1, BREP_VERTEX* v2)
v2 に対する v1 の位置を検査する.
0〜7 | Vertex の位置 | |
8 | 同じVertex |
Definition at line 1057 of file Brep.cpp.
References BREP_VERTEX::point, BREP_VERTEX::tolerance, BREP_VERTEX::uvmap, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Referenced by OctreeNode::AddWithDuplicates(), OctreeNode::AddWithUnique(), and OctreeNode::FindSubtree().
01058 { 01059 double tolerance = v1->tolerance + v2->tolerance; 01060 double dist2 = (v1->point.x - v2->point.x)*(v1->point.x - v2->point.x) + 01061 (v1->point.y - v2->point.y)*(v1->point.y - v2->point.y) + 01062 (v1->point.z - v2->point.z)*(v1->point.z - v2->point.z); 01063 if (dist2<=tolerance*tolerance && v1->uvmap==v2->uvmap) return 8; // 同じ位置.同じテクスチャマップ. 01064 01065 int code = 0; 01066 if (v1->point.x > v2->point.x) code += 1; 01067 if (v1->point.y > v2->point.y) code += 2; 01068 if (v1->point.z > v2->point.z) code += 4; 01069 return code; // x1 > x2 || y1 > y2 || z1 > z2 01070 }
int connectNumber | ( | int * | w, | |
int | c, | |||
int | d | |||
) |
int jbxl::connectNumber(int* w, int c, int d)
連結数の計算
w | w[] 近傍の連結数 | |
c | 近傍数 | |
d | 次元数 |
Definition at line 28 of file Thinning.cpp.
Referenced by deletable().
00029 { 00030 int i; 00031 int cn, n0, n1, n2; 00032 int v[27]; 00033 00034 if (d<3) { 00035 for(i=0; i<9; i++) v[i] = w[i]; 00036 if (c==8) { 00037 v[4] = 1 - v[4]; 00038 for (i=0; i<9; i++) v[i] = 1 - v[i]; 00039 } 00040 if (c==4 || c==8) { 00041 cn = v[1] - v[1]*v[0]*v[3]; 00042 cn += v[3] - v[3]*v[6]*v[7]; 00043 cn += v[5] - v[5]*v[2]*v[1]; 00044 cn += v[7] - v[7]*v[8]*v[5]; 00045 } 00046 else { 00047 cn = -1; 00048 } 00049 } 00050 else { 00051 for (i=0; i<27; i++) v[i] = w[i]; 00052 if (c==26) { 00053 v[13] = 1 - v[13]; 00054 for(i=0; i<27; i++) v[i] = 1 - v[i]; 00055 } 00056 if (c==6 || c==26) { 00057 n0 = v[13]*v[14] + v[13]*v[12] + 00058 v[13]*v[16] + v[13]*v[10] + 00059 v[13]*v[22] + v[13]*v[ 4]; 00060 00061 n1 = v[13]*v[14]*v[10]*v[11] + v[13]*v[14]*v[16]*v[17] + 00062 v[13]*v[14]*v[ 4]*v[ 5] + v[13]*v[14]*v[22]*v[23] + 00063 v[13]*v[12]*v[10]*v[ 9] + v[13]*v[12]*v[16]*v[15] + 00064 v[13]*v[12]*v[ 4]*v[ 3] + v[13]*v[12]*v[22]*v[21] + 00065 v[13]*v[10]*v[ 4]*v[ 1] + v[13]*v[10]*v[22]*v[19] + 00066 v[13]*v[16]*v[ 4]*v[ 7] + v[13]*v[16]*v[22]*v[25]; 00067 00068 n2 = v[13]*v[14]*v[10]*v[11]*v[ 4]*v[ 5]*v[ 1]*v[ 2] + 00069 v[13]*v[14]*v[10]*v[11]*v[22]*v[23]*v[19]*v[20] + 00070 v[13]*v[14]*v[16]*v[17]*v[ 4]*v[ 5]*v[ 7]*v[ 8] + 00071 v[13]*v[14]*v[16]*v[17]*v[22]*v[23]*v[25]*v[26] + 00072 v[13]*v[12]*v[10]*v[ 9]*v[ 4]*v[ 3]*v[ 1]*v[ 0] + 00073 v[13]*v[12]*v[10]*v[ 9]*v[22]*v[21]*v[19]*v[18] + 00074 v[13]*v[12]*v[16]*v[15]*v[ 4]*v[ 3]*v[ 7]*v[ 6] + 00075 v[13]*v[12]*v[16]*v[15]*v[22]*v[21]*v[25]*v[24]; 00076 00077 cn = n0 - n1 + n2; 00078 if (c==26) cn = 2 - cn; 00079 } 00080 else { 00081 cn = -1; 00082 } 00083 } 00084 00085 return cn; 00086 }
DllExport void ConnectWingToVertex | ( | BREP_WING * | wing | ) |
void jbxl::ConnectWingToVertex(BREP_WING* wing)
WingのスタートVertexのリングに,この Wingを登録する.
Wingが実在する(使用されている)ためには,このリングに登録されてることと,Contourから(へ) リンクされることである.
Definition at line 845 of file Brep.cpp.
References BREP_WING::vertex.
00846 { 00847 if (wing!=NULL) { 00848 (wing->vertex)->wing_list.push_back(wing); 00849 } 00850 }
void jbxl::copy_morph_element | ( | MSGraph< T > | vp, | |
int | x, | |||
int | y, | |||
int | z, | |||
MSGraph< T > | xp | |||
) | [inline] |
template <typename t>=""> void copy_morph_element(MSGraph<T> vp, int x, int y, int z, MSGraph<T> xp)
エレメントを対象画像にコピーする.
Definition at line 146 of file Morph.h.
References MSGraph< T >::gp, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
Referenced by fat_object_morph(), and opening_morph().
00147 { 00148 int i, j, k, cx, cy, cz; 00149 int xx, yy, zz, ax, ay, az; 00150 00151 for (k=0; k<xp.zs; k++) { 00152 zz = z + k - xp.zs/2; 00153 az = vp.xs*vp.ys*zz; 00154 cz = xp.xs*xp.ys*k; 00155 for (j=0; j<xp.ys; j++) { 00156 yy = y + j - xp.ys/2; 00157 ay = az + vp.xs*yy; 00158 cy = cz + xp.xs*j; 00159 for (i=0; i<xp.xs; i++) { 00160 xx = x + i - xp.xs/2; 00161 ax = ay + xx; 00162 cx = cy + i; 00163 if (xx>=0&&xx<vp.xs&&yy>=0&&yy<vp.ys&&zz>=0&&zz<vp.zs){ 00164 if (xp.gp[cx]>0) vp.gp[ax] = xp.gp[cx]; 00165 } 00166 } 00167 } 00168 } 00169 }
void jbxl::copy_MSGraph | ( | MSGraph< R > * | src, | |
MSGraph< T > * | dst | |||
) | [inline] |
template <typename R, typename T> void copy_MSGraph(MSGraph<R>* src, MSGraph<T>* dst)
MSGraph<R>型データのバッファ部を MSGraph<T>型のバッファ部へコピーする.
dstのデータ部がある場合は破棄される.
src | コピー元グラフィックデータ | |
dst | コピー先グラフィックデータ |
Definition at line 581 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::color, MSGraph< T >::free(), MSGraph< T >::getm(), MSGraph< T >::gp, JBXL_GRAPH_MEMORY_ERROR, MSGraph< T >::max, MSGraph< T >::min, MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00582 { 00583 if (src==NULL || dst==NULL) return; 00584 if ((void*)src->gp==(void*)dst->gp) return; 00585 00586 MSGraph<T> vp; 00587 00588 vp.getm(src->xs, src->ys, src->zs, (T)src->zero); 00589 if (vp.gp==NULL) { 00590 dst->free(); 00591 dst->gp = NULL; 00592 dst->state = JBXL_GRAPH_MEMORY_ERROR; 00593 return; 00594 } 00595 00596 vp.max = (T)src->max; 00597 vp.min = (T)src->min; 00598 vp.base = (T)src->base; 00599 vp.color = src->color; 00600 vp.state = src->state; 00601 for (int i=0; i<vp.xs*vp.ys*vp.zs; i++) vp.gp[i] = (T)src->gp[i]; 00602 00603 dst->free(); 00604 *dst = vp; 00605 return; 00606 }
void jbxl::copy_MSGraph | ( | MSGraph< R > | src, | |
MSGraph< T > & | dst | |||
) | [inline] |
template <typename R, typename T> void copy_MSGraph(MSGraph<R> src, MSGraph<T>& dst)
MSGraph<R>型データのバッファ部を MSGraph<T>型のバッファ部へコピーする.
dstのデータ部がある場合は破棄される.
src | コピー元グラフィックデータ | |
dst | コピー先グラフィックデータ |
Definition at line 545 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::color, MSGraph< T >::free(), MSGraph< T >::getm(), MSGraph< T >::gp, JBXL_GRAPH_MEMORY_ERROR, MSGraph< T >::max, MSGraph< T >::min, MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00546 { 00547 if ((void*)src.gp==(void*)dst.gp) return; 00548 00549 MSGraph<T> vp; 00550 00551 vp.getm(src.xs, src.ys, src.zs, (T)src.zero); 00552 if (vp.gp==NULL) { 00553 dst.free(); 00554 dst.gp = NULL; 00555 dst.state = JBXL_GRAPH_MEMORY_ERROR; 00556 return; 00557 } 00558 00559 vp.max = (T)src.max; 00560 vp.min = (T)src.min; 00561 vp.base = (T)src.base; 00562 vp.color = src.color; 00563 vp.state = src.state; 00564 for (int i=0; i<vp.xs*vp.ys*vp.zs; i++) vp.gp[i] = (T)src.gp[i]; 00565 00566 dst.free(); 00567 dst = vp; 00568 return; 00569 }
MSGraph<T> jbxl::copyCmnHead2MSGraph | ( | CmnHead | hd, | |
unsigned int | mode = CH2MG_NORMAL , |
|||
bool | cnt = false | |||
) | [inline] |
template <typename t>=""> MSGraph<T> copyCmnHead2MSGraph(CmnHead hd, unsigned int mode=CH2MG_NORMAL, bool cnt=false)
CmnHead から MSGraph<T>のデータを作り出す.
MSGraph<T>.gp のメモリ領域は別に作られる.グローバルカウンタが使用可能.
hd | 共通ヘッダ | |
mode | CH2MG_NORMAL (0) ノーマルコピー(デフォルト) CH2MG_NORZXY (1) Z軸の歪を処理しない. | |
cnt | カウンタを使用するか(デフォルト:使用しない false) |
JBXL_GRAPH_HEADER_ERROR | state ヘッダエラー | |
JBXL_GRAPH_MEMORY_ERROR | state メモリ確保エラー | |
JBXL_GRAPH_CANCEL | state ユーザによる中断 |
Definition at line 667 of file Gdata.h.
References MSGraph< T >::base, CmnHead::bsize, CmnHead::buf, CH2MG_NOPARM, checkBit, MSGraph< T >::color, CT_3D_VOL, CT_3DM, CT_DATA, CmnHead::depth, MSGraph< T >::free(), GetUsableGlobalCounter(), MSGraph< T >::gp, GRAPH_COLOR_MONO16, GRAPH_COLOR_RGB, CmnHead::grptr, HAS_BASE, HAS_RBOUND, HAS_RZXY, HEADER_NONE, MSGraph< T >::init(), CVCounter::isCanceled(), JBXL_GRAPH_CANCEL, JBXL_GRAPH_HEADER_ERROR, JBXL_GRAPH_MEMORY_ERROR, JPEG_MONO_DATA, JPEG_RGB_DATA, CmnHead::kind, Max, MSGraph< T >::max, Min, MSGraph< T >::min, CVCounter::PutFill(), MSGraph< T >::rbound, MSGraph< T >::RZxy, RZXY_RATE, MSGraph< T >::set(), CVCounter::SetMax(), MSGraph< T >::state, CVCounter::StepIt(), UN_KNOWN_DATA, RBound< T >::xmax, RBound< T >::xmin, MSGraph< T >::xs, CmnHead::xsize, RBound< T >::ymax, RBound< T >::ymin, MSGraph< T >::ys, CmnHead::ysize, RBound< T >::zmax, RBound< T >::zmin, MSGraph< T >::zs, and CmnHead::zsize.
00668 { 00669 MSGraph<T> vp; 00670 int kind = hd.kind & 0x00ff; 00671 00672 vp.init(); // vp.color = GRAPH_COLOR_UNKNOWN; 00673 00674 if (kind==UN_KNOWN_DATA || hd.kind==HEADER_NONE) { 00675 vp.state = JBXL_GRAPH_HEADER_ERROR; 00676 return vp; 00677 } 00678 00679 vp.set(hd.xsize, hd.ysize, hd.zsize); 00680 if (vp.gp==NULL) { vp.state = JBXL_GRAPH_MEMORY_ERROR; return vp;} 00681 00682 // カラータイプ 00683 if (kind==JPEG_RGB_DATA || kind==JPEG_MONO_DATA) { 00684 //if (hd.zsize==3) vp.color = GRAPH_COLOR_PRGB; 00685 if (hd.zsize==3) vp.color = GRAPH_COLOR_RGB; 00686 } 00687 else if (hd.depth==16) { 00688 vp.color = GRAPH_COLOR_MONO16; 00689 } 00690 00691 // カウンタ.ここでは,delete禁止 00692 CVCounter* counter = NULL; 00693 if (vp.zs>=10 && cnt) { 00694 counter = GetUsableGlobalCounter(); 00695 if (counter!=NULL) counter->SetMax(vp.zs/10); 00696 } 00697 00698 int ks, js, ln; 00699 ln = vp.xs*vp.ys; 00700 00701 if (hd.depth==16){ 00702 sWord* bp = (sWord*)hd.grptr; 00703 vp.max = vp.min = bp[0]; 00704 for (int k=0; k<vp.zs; k++) { 00705 ks = k*ln; 00706 for (int j=0; j<vp.xs*vp.ys; j++) { 00707 js = j+ ks; 00708 vp.gp[js] = bp[js]; 00709 vp.max = Max(vp.max, vp.gp[js]); 00710 vp.min = Min(vp.min, vp.gp[js]); 00711 } 00712 00713 if (counter!=NULL && k%10==0) { 00714 counter->StepIt(); 00715 if (counter->isCanceled()) { // キャンセル 00716 vp.free(); 00717 vp.state = JBXL_GRAPH_CANCEL; 00718 return vp; 00719 } 00720 } 00721 00722 } 00723 } 00724 00725 else if (hd.depth<16){ // ==8 00726 //int uint = (unsigned char)hd.grptr[0]; 00727 vp.max = vp.min = (T)((unsigned char)hd.grptr[0]); 00728 for (int k=0; k<vp.zs; k++) { 00729 ks = k*ln; 00730 for (int j=0; j<vp.xs*vp.ys; j++) { 00731 js = j + ks; 00732 vp.gp[js] = (T)((unsigned char)hd.grptr[js]); 00733 vp.max = Max(vp.max, vp.gp[js]); 00734 vp.min = Min(vp.min, vp.gp[js]); 00735 } 00736 00737 if (counter!=NULL && k%10==0) { 00738 counter->StepIt(); 00739 if (counter->isCanceled()) { // キャンセル 00740 vp.free(); 00741 vp.state = JBXL_GRAPH_CANCEL; 00742 return vp; 00743 } 00744 } 00745 } 00746 } 00747 00748 else { 00749 vp.max = vp.min = (T)((uByte)hd.grptr[0]>>(hd.depth-15)); 00750 for (int k=0; k<vp.zs; k++) { 00751 ks = k*ln; 00752 for (int j=0; j<vp.xs*vp.ys; j++) { 00753 js = j + ks; 00754 vp.gp[js] = (T)((uByte)hd.grptr[js]>>(hd.depth-15)); 00755 vp.max = Max(vp.max, vp.gp[js]); 00756 vp.min = Min(vp.min, vp.gp[js]); 00757 } 00758 00759 if (counter!=NULL && k%10==0) { 00760 counter->StepIt(); 00761 if (counter->isCanceled()) { // キャンセル 00762 vp.free(); 00763 vp.state = JBXL_GRAPH_CANCEL; 00764 return vp; 00765 } 00766 } 00767 } 00768 } 00769 00770 // もし存在するなら,ヘッダ部分から Z方向の歪率, rboundを取り出す. 00771 if (!checkBit(mode, CH2MG_NOPARM)) { 00772 if (hd.bsize>0 && (kind==CT_DATA || kind==CT_3DM || kind==CT_3D_VOL)) { 00773 sWord* rz = (sWord*)hd.buf; 00774 if (rz[9]==RZXY_RATE || checkBit(hd.kind, HAS_RZXY)) { 00775 double rzm = rz[8]/(double)rz[9]; 00776 if (rzm<5.0 && rzm>0.) vp.RZxy = rzm; 00777 } 00778 00779 if (rz[10]!=0 && checkBit(hd.kind, HAS_BASE)) { 00780 vp.base = (T)rz[10]; 00781 } 00782 00783 if (checkBit(hd.kind, HAS_RBOUND)) { 00784 vp.rbound.xmin = rz[6]; 00785 vp.rbound.xmax = rz[7]; 00786 vp.rbound.ymin = rz[4]; 00787 vp.rbound.ymax = rz[5]; 00788 vp.rbound.zmin = rz[2]; 00789 vp.rbound.zmax = rz[3]; 00790 } 00791 } 00792 } 00793 00794 if (counter!=NULL) counter->PutFill(); 00795 00796 return vp; 00797 }
CmnHead jbxl::copyMSGraph2CmnHead | ( | MSGraph< T > & | vp, | |
unsigned int | mode = MG2CH_NORMAL , |
|||
bool | cnt = false | |||
) | [inline] |
template <typename t>=""> CmnHead copyMSGraph2CmnHead(MSGraph<T>& vp, unsigned int mode=MG2CH_NORMAL, bool cnt=false)
MSGraph<T> から CmnHeadのデータを作り出す.
CmnHead.grptr のメモリ領域は別に作られる.vpに関しては vp.max, vp.minが設定される.
グローバルカウンタが使用可能.
vp | コピー元のグラフィックデータ | |
mode | MG2CH_NORMAL (0) ノーマルコピー(デフォルト) MG2CH_NORZXY (1) Z軸の歪を処理しない. MG2CH_CONTRAST (2) コントラスト調整 MG2CH_OCTET (4) 8bitへ変換 | |
cnt | カウンタを使用するか(デフォルト:使用しない false) |
HEADER_NONE | kind エラー | |
JBXL_GRAPH_HEADER_ERROR | xsize ヘッダエラー | |
JBXL_GRAPH_MEMORY_ERROR | xsize メモリ確保エラー | |
JBXL_GRAPH_CANCEL | xsize ユーザによる中断 |
Definition at line 822 of file Gdata.h.
References MSGraph< T >::base, CmnHead::bsize, CmnHead::buf, checkBit, CTHead::cutdown, CTHead::cutright, CmnHead::depth, free_CmnHead(), GetUsableGlobalCounter(), MSGraph< T >::gp, CmnHead::grptr, HAS_BASE, HAS_RBOUND, HAS_RZXY, HEADER_NONE, CVCounter::isCanceled(), JBXL_GRAPH_CANCEL, JBXL_GRAPH_HEADER_ERROR, JBXL_GRAPH_MEMORY_ERROR, CmnHead::kind, CmnHead::lsize, MSGraph< T >::max, Max, MG2CH_CONTRAST, MG2CH_NOPARM, MG2CH_NORMAL, MG2CH_OCTET, MSGraph< T >::min, Min, CVCounter::PutFill(), MSGraph< T >::rbound, MSGraph< T >::RZxy, RZXY_RATE, CVCounter::SetMax(), CVCounter::StepIt(), RBound< T >::xmax, RBound< T >::xmin, MSGraph< T >::xs, CTHead::xsize, CmnHead::xsize, RBound< T >::ymax, RBound< T >::ymin, MSGraph< T >::ys, CTHead::ysize, CmnHead::ysize, RBound< T >::zmax, RBound< T >::zmin, MSGraph< T >::zs, and CmnHead::zsize.
Referenced by readGraphicSlices(), and writeRasFile().
00823 { 00824 CmnHead hd; 00825 CTHead ct; 00826 00827 memset(&ct, 0, sizeof(CTHead)); 00828 memset(&hd, 0, sizeof(CmnHead)); 00829 00830 if (vp.gp==NULL) { 00831 hd.xsize = JBXL_GRAPH_HEADER_ERROR; 00832 hd.kind = HEADER_NONE; 00833 return hd; 00834 } 00835 00836 // 00837 hd.kind = 0; // MSGraphからのコピー時には,ヘッダ情報は既に消失している. 00838 hd.xsize = ct.xsize = ct.cutright= vp.xs; 00839 hd.ysize = ct.ysize = ct.cutdown = vp.ys; 00840 hd.zsize = vp.zs; 00841 00842 if (checkBit(mode, MG2CH_OCTET)) hd.depth = 8; 00843 else hd.depth = sizeof(T)*8; 00844 hd.lsize = hd.xsize*hd.ysize*hd.zsize*(hd.depth/8); 00845 hd.bsize = sizeof(CTHead); 00846 00847 hd.grptr = (uByte*)malloc(hd.lsize*sizeof(uByte)); 00848 if (hd.grptr==NULL) { 00849 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00850 hd.kind = HEADER_NONE; 00851 return hd; 00852 } 00853 hd.buf = (uByte*)malloc(hd.bsize*sizeof(uByte)); 00854 if (hd.buf==NULL) { 00855 free_CmnHead(&hd); 00856 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00857 return hd; 00858 } 00859 00860 // カウンタ.ここでは,delete禁止 00861 CVCounter* counter = NULL; 00862 00863 if (hd.zsize>=5 && cnt) { 00864 counter = GetUsableGlobalCounter(); 00865 if (counter!=NULL) counter->SetMax(hd.zsize*2/10); 00866 } 00867 00868 // 最大値,最小値を求める 00869 int j, k, ks, js, ln; 00870 T max, min; 00871 max = min = vp.gp[0]; 00872 00873 ln = vp.xs*vp.ys; 00874 for (k=0; k<vp.zs; k++) { 00875 ks = k*ln; 00876 for (j=0; j<vp.ys*vp.xs; j++) { 00877 js = j + ks; 00878 min = Min(vp.gp[js], min); 00879 max = Max(vp.gp[js], max); 00880 } 00881 00882 // カウンタ 00883 if (counter!=NULL && k%10==0) { 00884 counter->StepIt(); 00885 if (counter->isCanceled()) { // キャンセル 00886 free_CmnHead(&hd); 00887 hd.xsize = JBXL_GRAPH_CANCEL; 00888 return hd; 00889 } 00890 } 00891 } 00892 vp.max = max; 00893 vp.min = min; 00894 00895 // ノーマルコピー 00896 if (mode==MG2CH_NORMAL) { 00897 memcpy(hd.grptr, vp.gp, hd.lsize); 00898 } 00899 00900 // 8bitへ変換 00901 else if (checkBit(mode, MG2CH_OCTET)) { 00902 // 255以下はコントラスト調整しない 00903 if (!checkBit(mode, MG2CH_CONTRAST) && vp.max<=255 && vp.min>=0) { 00904 max = 255; 00905 min = 0; 00906 } 00907 00908 for (k=0; k<hd.zsize; k++) { 00909 ks = k*ln; 00910 for (j=0; j<hd.xsize*hd.ysize; j++) { 00911 js = j + ks; 00912 hd.grptr[js] = (uByte)(((vp.gp[js]-min)/(double)(max-min))*255.); 00913 } 00914 00915 // カウンタ 00916 if (counter!=NULL && k%10==0) { 00917 counter->StepIt(); 00918 if (counter->isCanceled()) { // キャンセル 00919 free_CmnHead(&hd); 00920 hd.xsize = JBXL_GRAPH_CANCEL; 00921 return hd; 00922 } 00923 } 00924 } 00925 } 00926 if (counter!=NULL) counter->PutFill(); 00927 00928 memcpy(hd.buf, &ct, hd.bsize); 00929 00930 // Z方向の歪率, rboundの設定. 00931 if (!checkBit(mode, MG2CH_NOPARM)) { 00932 sWord* rz = (sWord*)hd.buf; 00933 if (vp.RZxy!=1.0) { 00934 hd.kind = hd.kind | HAS_RZXY; 00935 rz[9] = (sWord)RZXY_RATE; 00936 rz[8] = (sWord)(vp.RZxy*RZXY_RATE); 00937 } 00938 if (vp.base!=0) { 00939 rz[10] = (sWord)vp.base; 00940 hd.kind |= HAS_BASE; 00941 } 00942 rz[2] = (sWord)vp.rbound.zmin; 00943 rz[3] = (sWord)vp.rbound.zmax; 00944 rz[4] = (sWord)vp.rbound.ymin; 00945 rz[5] = (sWord)vp.rbound.ymax; 00946 rz[6] = (sWord)vp.rbound.xmin; 00947 rz[7] = (sWord)vp.rbound.xmax; 00948 hd.kind |= HAS_RBOUND; 00949 } 00950 00951 return hd; 00952 }
cv::Mat jbxl::copyMSGraph2CvMat | ( | MSGraph< T > * | vp | ) | [inline] |
template <typename R, typename T> cv::Mat copyMSGraph2CvMat(MSGraph<T>* vp)
MSGraph<T> vp から OpenCV用の Matデータ(型R)を作り出す.
型 T, R の整合性は呼び出し側の責任. 現在は T->R で単純にキャスト可能な場合にしか対応していない.
vp.color による Matの構成は今後....
vp | 元のグラフィックデータ |
cv::Mat imag = copyMSGraph2CvMat<uByte>(*vp);
Definition at line 124 of file OpenCVTool.h.
References MSGraph< T >::gp, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
00125 { 00126 cv::Mat mat; 00127 00128 if (vp->zs<=1) { 00129 vp->zs = 1; 00130 mat = cv::Mat_<R>(vp->ys, vp->xs); 00131 00132 // 通常は連続しているはず 00133 if (mat.isContinuous()) { 00134 R* dst = mat.ptr<R>(0); 00135 for (int i=0; i<vp->xs*vp->ys; i++) { 00136 dst[i] = (R)vp->gp[i]; 00137 } 00138 } 00139 else { 00140 for (int j=0; j<vp->ys; j++) { 00141 R* dst = mat.ptr<R>(j); 00142 T* src = &(vp->gp[j*vp->xs]); 00143 for (int i=0; i<vp->xs; i++) { 00144 dst[i] = (R)src[i]; 00145 } 00146 } 00147 } 00148 } 00149 00150 // 00151 else { 00152 int size[3]; 00153 size[0] = vp->zs; 00154 size[1] = vp->ys; 00155 size[2] = vp->xs; 00156 mat = cv::Mat_<R>(3, size); 00157 00158 // 通常は連続しているはず 00159 if (mat.isContinuous()) { 00160 R* dst = (R*)mat.data; 00161 for (int i=0; i<vp->xs*vp->ys*vp->zs; i++) { 00162 dst[i] = (R)vp->gp[i]; 00163 } 00164 } 00165 else { 00166 for (int k=0; k<vp->zs; k++) { 00167 int kk = k*vp->ys*vp->xs; 00168 for (int j=0; j<vp->ys; j++) { 00169 R* dst = mat.ptr<R>(k, j); 00170 T* src = &(vp->gp[j*vp->xs + kk]); 00171 for (int i=0; i<vp->xs; i++) { 00172 dst[i] = (R)src[i]; 00173 } 00174 } 00175 } 00176 } 00177 } 00178 00179 return mat; 00180 }
int jbxl::count_area_MSGraph | ( | MSGraph< T > | xp | ) | [inline] |
template <typename t>=""> int count_area_MSGraph(MSGraph<T> xp)
面積を測る.
Definition at line 230 of file Graph.h.
References MSGraph< T >::gp, MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
Referenced by dgree_circle_MSGraph().
00231 { 00232 int ss = 0; 00233 00234 for (int i=0; i<xp.xs*xp.ys*xp.zs; i++) { 00235 if (xp.gp[i]!=xp.zero) ss++; 00236 } 00237 return ss; 00238 }
double jbxl::count_around_MSGraph | ( | MSGraph< T > | vp | ) | [inline] |
Definition at line 186 of file Graph.h.
References MSGraph< T >::free(), MSGraph< T >::isNull(), OFF, MSGraph< T >::point(), MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and zoom_MSGraph().
Referenced by dgree_circle_MSGraph().
00187 { 00188 int i, j, m, n, cc; 00189 bool sflg; 00190 double cnt; 00191 const double qs = 0.70710678118654752440084436210; // sqrt(2.)/2. 00192 MSGraph<T> xp; 00193 00194 xp = zoom_MSGraph(vp, 2, OFF); 00195 if (xp.isNull()) return -1.0; 00196 00197 cnt = 0.0; 00198 for (j=1; j<xp.ys-1; j+=2) { 00199 for (i=1; i<xp.xs-1; i+=2) { 00200 cc = 0; 00201 sflg = false; 00202 for (n=0; n<2; n++) { 00203 for (m=0; m<2; m++) { 00204 if (xp.point(i+m, j+n)!=vp.zero) { 00205 cc++; 00206 if (n>0) if (xp.point(i+(1-m), j)!=vp.zero) sflg = true; // 対角チェック 00207 } 00208 } 00209 } 00210 00211 if (cc==1 || cc==3) cnt += qs; 00212 else if (cc==2) { 00213 if (sflg==false) cnt += 1; 00214 else cnt += 2; 00215 } 00216 } 00217 } 00218 xp.free(); 00219 00220 return cnt; 00221 }
int jbxl::count_object_MSGraph | ( | MSGraph< T > | xp, | |
int | mn, | |||
int | mx | |||
) | [inline] |
Definition at line 242 of file Graph.h.
References MSGraph< T >::free(), MSGraph< T >::gp, MSGraph< T >::mimicry(), MSGraph_Paint(), MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00243 { 00244 int cnt = 0; 00245 int nx, ny; 00246 MSGraph<T> pp; 00247 00248 pp.mimicry(xp); 00249 for (int i=0; i<pp.xs*pp.ys*pp.zs; i++) pp.gp[i] = xp.gp[i]; 00250 00251 MSGraph_Paint(pp, 0, 0, pp.zero, pp.zero, mx+1, 4); 00252 00253 for (int j=0; j<pp.ys; j++) { 00254 ny = pp.xs*j; 00255 for (int i=0; i<pp.xs; i++) { 00256 nx = ny + i; 00257 if (pp.gp[nx]==pp.zero) { 00258 MSGraph_Paint(pp, i, j, pp.zero, pp.zero, mx, 8); 00259 } 00260 } 00261 } 00262 00263 MSGraph_Paint(pp, 0, 0, mx+1, mx+1, pp.zero, 4); 00264 00265 for (int j=0; j<pp.ys; j++) { 00266 ny = pp.xs*j; 00267 for (int i=0; i<pp.xs; i++) { 00268 nx = ny + i; 00269 if (pp.gp[nx]>=mn && pp.gp[nx]<=mx) { 00270 MSGraph_Paint(pp, i, j, mn, mx, pp.zero, 8); 00271 cnt++; 00272 } 00273 } 00274 } 00275 pp.free(); 00276 00277 return cnt; 00278 }
DllExport BREP_CONTOUR * CreateContourByVector | ( | BREP_FACET * | facet, | |
Vector< double > * | vect, | |||
Vector< double > * | nrml = NULL , |
|||
UVMap< double > * | uvmp = NULL , |
|||
bool | dupli = false | |||
) |
BREP_CONTOUR* jbxl::CreateContourByVector(BREP_FACET* facet, Vector<double>* vect, Vector<double>* nrml, UVMap<double>* uvmp, bool dupli)
Facet と Vector[] から Contour を作る.
vect[0]〜vect[2] は3点の位置ベクトル(順序付けされている) nrml[0]〜nrml[2] は3点の法線ベクトル(NULL なら再計算される) uvmp[0]〜uvmp[2] は3点の曲面座標データ.
facet | FACETデータへのポインタ | |
vect | 3個の頂点データ vect[3] へのポインタ | |
nrml | 頂点の法線ベクトルデータへのポインタ. | |
uvmp | 頂点の曲面座標データへのポインタ. | |
dupli | true: 頂点の重複登録を許可する.false: 重複登録を許可しない. |
Definition at line 701 of file TriBrep.cpp.
References AddVertex2Octree(), BREP_VERTEX, BREP_VERTEX::calc_normal, BREP_VERTEX::CloseData(), CreateContourByVertex(), IsForbiddenEdge(), BREP_VERTEX::normal, BREP_SOLID::octree, BREP_VERTEX::point, BREP_FACET::shell, BREP_SHELL::solid, and BREP_VERTEX::uvmap.
Referenced by BrepSolidList::addSolid(), AddVector2TriSolid(), CreateTriSolidFromSTL(), CreateTriSolidFromVector(), and BrepSolidList::getMerge().
00702 { 00703 BREP_SOLID* solid; 00704 BREP_CONTOUR* contour; 00705 BREP_VERTEX* vertex[3]; 00706 00707 solid = facet->shell->solid; 00708 00709 // Vertex の生成 00710 for (int i=0; i<3; i++) { 00711 vertex[i] = new BREP_VERTEX(); 00712 vertex[i]->point = vect[i]; 00713 if (nrml!=NULL) { 00714 vertex[i]->calc_normal = false; 00715 vertex[i]->normal = nrml[i]; 00716 } 00717 if (uvmp!=NULL) { 00718 vertex[i]->uvmap = uvmp[i]; 00719 } 00720 vertex[i]->CloseData(); 00721 } 00722 00723 // 同じ点がある.または3点が直線上にある. 00724 if (vertex[0]==vertex[1] || vertex[1]==vertex[2] || vertex[0]==vertex[2]) return NULL; 00725 if (IsForbiddenEdge(vertex)) return NULL; 00726 00727 // Vertexをソリッドの Octreeに登録 00728 BREP_VERTEX* vert; 00729 for (int i=0; i<3; i++) { 00730 vert = AddVertex2Octree(vertex[i], solid->octree, dupli); 00731 if (vert!=vertex[i]) { 00732 delete vertex[i]; 00733 vertex[i] = vert; 00734 } 00735 } 00736 00737 contour = CreateContourByVertex(facet, vertex); 00738 00739 return contour; 00740 }
DllExport BREP_CONTOUR * CreateContourByVertex | ( | BREP_FACET * | facet, | |
BREP_VERTEX ** | vertex | |||
) |
BREP_CONTOUR* jbxl::CreateContourByVertex(BREP_FACET* facet, BREP_VERTEX** vertex)
Facet と Vertex[3] から Vertex を作る. vertex[0]〜vertex[2] は 3点の Vertex(順序付けされている)
Definition at line 750 of file TriBrep.cpp.
References BREP_CONTOUR, BREP_CONTOUR::CloseData(), BREP_CONTOUR::CreateWing(), and IsForbiddenEdge().
Referenced by CreateContourByVector(), PatchupContour(), and ReverseContours().
00751 { 00752 // 同じ点がある.または3点が直線上にある. 00753 if (vertex[0]==vertex[1] || vertex[1]==vertex[2] || vertex[0]==vertex[2]) return NULL; 00754 if (IsForbiddenEdge(vertex)) return NULL; 00755 00756 BREP_CONTOUR* contour = new BREP_CONTOUR(facet); 00757 00758 // Wingを作る. 00759 BREP_WING* wing = contour->CreateWing(vertex[0], vertex[1]); 00760 if (wing!=NULL) wing = contour->CreateWing(vertex[1], vertex[2]); 00761 if (wing!=NULL) wing = contour->CreateWing(vertex[2], vertex[0]); 00762 if (wing!=NULL) { 00763 contour->CloseData(); // 面の法線ベクトルを計算. 00764 } 00765 else { 00766 delete(contour); 00767 contour = NULL; 00768 } 00769 00770 return contour; 00771 }
DllExport void CreateContoursList | ( | BREP_SOLID * | solid | ) |
void jbxl:: CreateContoursList(BREP_SOLID* solid)
削除マークの付いたContour(Facet)を削除し,全Contour(Facet)の Listを作る.
ただし,読み込み(初期)データは削除しない.
Definition at line 24 of file TriBrep.cpp.
References BREP_SOLID::contours, BREP_SOLID::facetno, BREP_FACET::shell, and BREP_SOLID::shells.
Referenced by CloseTriSolid(), DeleteShortageWings(), DeleteStraightEdges(), FillShortageWings_Near(), FillShortageWings_Next(), JoinShortageWings(), and ReverseContours().
00025 { 00026 solid->contours.clear(); 00027 00028 BREP_SHELL_LIST shells = solid->shells; 00029 BREP_SHELL_LIST::iterator ishell; 00030 for (ishell=shells.begin(); ishell!=shells.end(); ishell++){ 00031 BREP_FACET* pbfc; 00032 BREP_FACET_LIST::iterator ifacet; 00033 for (ifacet =(*ishell)->facets.begin(); ifacet!=(*ishell)->facets.end(); ifacet++){ 00034 if ((*ifacet)->deletable && !(*ifacet)->notdelete) { 00035 pbfc = *ifacet; 00036 ifacet = (*ishell)->facets.erase(ifacet); 00037 ifacet--; 00038 pbfc->shell = NULL; 00039 delete(pbfc); 00040 } 00041 else { 00042 BREP_CONTOUR_LIST::iterator icon; 00043 for (icon=(*ifacet)->outer_contours.begin(); icon!=(*ifacet)->outer_contours.end(); icon++) { 00044 (*ifacet)->deletable = false; 00045 solid->contours.push_back(*icon); 00046 } 00047 } 00048 } 00049 } 00050 solid->facetno = (int)solid->contours.size(); 00051 }
DllExport BREP_EDGE * CreateEdge | ( | BREP_VERTEX * | v1, | |
BREP_VERTEX * | v2 | |||
) |
Definition at line 1037 of file Brep.cpp.
References BREP_EDGE, and BREP_EDGE::CloseData().
Referenced by CreateWingWithoutContour().
01038 { 01039 if (v1==v2) return NULL; 01040 01041 BREP_EDGE* edge = new BREP_EDGE(v1, v2); 01042 edge->CloseData(); 01043 01044 return edge; 01045 }
DllExport void CreateShortageWingsList | ( | BREP_SOLID * | solid | ) |
void jbxl::CreateShortageWingsList(BREP_SOLID* solid)
不完全な Wingの Listを作る.WingsListを利用する.
CreateContoursList(), CreateWingsList()に依存する.
Definition at line 110 of file TriBrep.cpp.
References BREP_SOLID::shortage_wings, and BREP_SOLID::wings.
Referenced by CloseTriSolid(), DeleteSurplusContours(), and FillShortageWings().
00111 { 00112 solid->shortage_wings.clear(); 00113 00114 BREP_WING_LIST::iterator iwing; 00115 for (iwing=solid->wings.begin(); iwing!=solid->wings.end(); iwing++){ 00116 if ((*iwing)->contour==NULL) solid->shortage_wings.push_back(*iwing); 00117 } 00118 }
DllExport void CreateSurplusContoursList | ( | BREP_SOLID * | solid | ) |
void jbxl::CreateSurplusContoursList(BREP_SOLID* solid)
多重Edgeを持つ Contourの Listを作る.
CreateContoursList()に依存する.
Definition at line 88 of file TriBrep.cpp.
References BREP_SOLID::contours, DupEdgeNumber(), and BREP_SOLID::surplus_contours.
Referenced by CloseTriSolid(), and DeleteSurplusContours().
00089 { 00090 // DEBUG_MODE PRINT_MESG("Start CreateSurplusContoursList\n"); 00091 solid->surplus_contours.clear(); 00092 00093 BREP_CONTOUR_LIST::iterator icon; 00094 for (icon=solid->contours.begin(); icon!=solid->contours.end(); icon++){ 00095 if (DupEdgeNumber(*icon)>0) { 00096 solid->surplus_contours.push_back(*icon); 00097 } 00098 } 00099 // DEBUG_MODE PRINT_MESG("END CreateSurplusContoursList\n"); 00100 }
DllExport int CreateTriSolidFromSTL | ( | BREP_SOLID * | solid, | |
STLData * | stldata, | |||
int | fno, | |||
bool | check = true | |||
) |
int jbxl::CreateTriSolidFromSTL(BREP_SOLID* solid, STLData* stldata, int fno, bool check)
STLDataから BREP_SOLIDを生成する.BREP_SOLIDに使用された有効なファセットの数を返す.
STLData中の法線ベクトルは無視して再計算する.
カウンタ使用可能.
solid | ソリッドデータへのポインタ | |
stldata | STLデータへのポインタ | |
fno | Facet(STLデータ)の数 | |
check | データの不正検査を行うか? |
-1 | ソリッドがNULL,stldataがNULL またはソリッドの Octreeが NULL | |
-3 | 操作がキャンセルされた. |
Definition at line 1256 of file TriBrep.cpp.
References BREP_FACET, BREP_SHELL, CloseTriSolid(), BREP_SOLID::contours, BREP_SOLID::counter, CreateContourByVector(), deleteNull(), CVCounter::GetUsableCounter(), CVCounter::isCanceled(), Max, BREP_SOLID::octree, CVCounter::PutFill(), CVCounter::ResetRate(), CVCounter::SetMax(), CVCounter::StepIt(), STLData::vect, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
01257 { 01258 BREP_SHELL* shell; 01259 BREP_FACET* facet; 01260 BREP_CONTOUR* contour; 01261 CVCounter* counter = NULL; 01262 Vector<double> v[4]; 01263 01264 if (solid==NULL || stldata==NULL) return -1; 01265 if (solid->octree==NULL) return -1; 01266 01267 solid->contours.clear(); 01268 01269 // カウンタ 01270 int intvl = 1; 01271 if (solid->counter!=NULL) { 01272 counter = solid->counter->GetUsableCounter(); 01273 if (counter!=NULL) { 01274 counter->SetMax(100); 01275 counter->ResetRate(80, 100); 01276 intvl = Max(1, fno/100); 01277 } 01278 } 01279 01280 shell = new BREP_SHELL(solid); 01281 for (int i=0; i<fno; i++) { 01282 // 読み込んだ STLデータを作業用Vector変数に格納 01283 v[0].x = stldata[i].vect[3]; v[0].y = stldata[i].vect[4]; v[0].z = stldata[i].vect[5]; 01284 v[1].x = stldata[i].vect[6]; v[1].y = stldata[i].vect[7]; v[1].z = stldata[i].vect[8]; 01285 v[2].x = stldata[i].vect[9]; v[2].y = stldata[i].vect[10]; v[2].z = stldata[i].vect[11]; 01286 // ここでは法線ベクトルは 再計算させる. 01287 01288 facet = new BREP_FACET(shell); 01289 contour = CreateContourByVector(facet, v, NULL, NULL, false); 01290 if (contour!=NULL) { 01291 /* 01292 if (check) { 01293 // 衝突判定 01294 BREP_CONTOUR* collision; 01295 facet->CloseData(); 01296 if (!IsCollisionContours(solid, contour, &collision)) { 01297 solid->contours.push_back(contour); // IsCollisionContours()用 01298 } 01299 else { 01300 collision->facet->deletable = true; // 衝突相手も消す. 01301 FastDeleteFacet(facet); 01302 } 01303 } 01304 else solid->contours.push_back(contour); 01305 */ 01306 solid->contours.push_back(contour); 01307 } 01308 else { 01309 deleteNull(facet); // 中身は空 01310 } 01311 01312 if (counter!=NULL && i%intvl==0) { 01313 counter->StepIt(); 01314 if (counter->isCanceled()) { 01315 deleteNull(facet); 01316 return -3; 01317 } 01318 } 01319 } 01320 if (counter!=NULL) counter->PutFill(); 01321 01322 // 01323 fno = CloseTriSolid(solid, check, counter); 01324 01325 return fno; 01326 }
DllExport int CreateTriSolidFromVector | ( | BREP_SOLID * | solid, | |
int | vno, | |||
Vector< double > * | vect, | |||
Vector< double > * | nrml = NULL , |
|||
UVMap< double > * | uvmp = NULL , |
|||
bool | dupli = false , |
|||
bool | check = true | |||
) |
Vector<double>から BREP_SOLIDを生成する.BREP_SOLIDに使用された有効なファセットの数を返す.
カウンタ使用可能.
solid | ソリッドデータへのポインタ | |
vno | 頂点データの数 | |
vect | 頂点の座標データへのポインタ. | |
nrml | 頂点の法線ベクトルデータへのポインタ. | |
uvmp | 頂点の曲面座標データへのポインタ. | |
dupli | true: 頂点の重複登録を許可する.false: 重複登録を許可しない. | |
check | データの不正検査を行うか? |
-1 | ソリッドがNULL,stldataがNULL またはソリッドの Octreeが NULL | |
-3 | 操作がキャンセルされた. |
Definition at line 1347 of file TriBrep.cpp.
References BREP_FACET, BREP_SHELL, CloseTriSolid(), BREP_SOLID::contours, BREP_SOLID::counter, CreateContourByVector(), deleteNull(), CVCounter::GetUsableCounter(), CVCounter::isCanceled(), Max, BREP_SOLID::octree, CVCounter::PutFill(), CVCounter::ResetRate(), CVCounter::SetMax(), and CVCounter::StepIt().
Referenced by MeshObjectNode::computeVertexByBREP().
01348 { 01349 BREP_SHELL* shell; 01350 BREP_FACET* facet; 01351 BREP_CONTOUR* contour; 01352 CVCounter* counter = NULL; 01353 int fno = vno/3; 01354 01355 if (solid==NULL || vect==NULL) return -1; 01356 if (solid->octree==NULL) return -1; 01357 01358 solid->contours.clear(); 01359 01360 // カウンタ 01361 int intvl = 1; 01362 if (solid->counter!=NULL) { 01363 counter = solid->counter->GetUsableCounter(); 01364 if (counter!=NULL) { 01365 counter->SetMax(100); 01366 counter->ResetRate(80, 100); 01367 intvl = Max(1, fno/100); 01368 } 01369 } 01370 01371 Vector<double>* normal = NULL; 01372 UVMap<double>* uvmap = NULL; 01373 shell = new BREP_SHELL(solid); 01374 // 01375 for (int i=0; i<fno; i++) { 01376 facet = new BREP_FACET(shell); 01377 if (nrml!=NULL) normal = nrml + i*3; 01378 if (uvmp!=NULL) uvmap = uvmp + i*3; 01379 contour = CreateContourByVector(facet, vect+i*3, normal, uvmap, dupli); 01380 01381 if (contour!=NULL) { 01382 /* 01383 if (check) { 01384 // 衝突判定. 01385 BREP_CONTOUR* collision; 01386 facet->CloseData(); 01387 if (!IsCollisionContours(solid, contour, &collision)) { 01388 solid->contours.push_back(contour); // IsCollisionContours()用 01389 } 01390 else { 01391 collision->facet->deletable = true; // 衝突相手も消す. 01392 FastDeleteFacet(facet); 01393 } 01394 } 01395 else solid->contours.push_back(contour); 01396 */ 01397 solid->contours.push_back(contour); 01398 } 01399 else { 01400 deleteNull(facet); // 中身は空 01401 } 01402 01403 if (counter!=NULL && i%intvl==0) { 01404 counter->StepIt(); 01405 if (counter->isCanceled()) { 01406 deleteNull(facet); 01407 return -3; 01408 } 01409 } 01410 } 01411 if (counter!=NULL) counter->PutFill(); 01412 01413 // 01414 fno = CloseTriSolid(solid, check, counter); 01415 01416 return fno; 01417 }
DllExport void CreateWingsList | ( | BREP_SOLID * | solid | ) |
void jbxl::CreateWingsList(BREP_SOLID* solid)
全 Wingの Listを作る.(Contourに結び付けられていないものも含む)
CreateContoursList()に依存する.
Definition at line 61 of file TriBrep.cpp.
References BREP_EDGE::complete, BREP_SOLID::contours, BREP_WING::edge, GetWingOtherSide(), BREP_WING::next, and BREP_SOLID::wings.
Referenced by CloseTriSolid(), DeleteShortageWings(), DeleteStraightEdges(), FillShortageWings_Near(), FillShortageWings_Next(), JoinShortageWings(), and ReverseContours().
00062 { 00063 solid->wings.clear(); 00064 00065 BREP_CONTOUR_LIST::iterator icon; 00066 for (icon=solid->contours.begin(); icon!=solid->contours.end(); icon++) { 00067 BREP_WING* first = (*icon)->wing; 00068 if (first!=NULL) { 00069 BREP_WING* next = first; 00070 do { 00071 BREP_WING* wing = next; 00072 next = wing->next; 00073 solid->wings.push_back(wing); 00074 if (!wing->edge->complete) solid->wings.push_back(GetWingOtherSide(wing)); 00075 } while(next!=first); 00076 } 00077 } 00078 }
DllExport BREP_WING * CreateWingWithoutContour | ( | BREP_VERTEX * | vertex1, | |
BREP_VERTEX * | vertex2 | |||
) |
BREP_WING* jbxl::CreateWingWithoutContour(BREP_VERTEX* vertex1, BREP_VERTEX* vertex2)
vertex1をスタートVertexとしたWingを(必要ならEdgeも)作成して返す.
Wingが作成された時点では,WingはContourには関連付けられていない.
Definition at line 861 of file Brep.cpp.
References BREP_WING::contour, CreateEdge(), BREP_EDGE::edge_list, FindEdge(), BREP_WING::vertex, BREP_EDGE::wing1, and BREP_EDGE::wing2.
Referenced by BREP_CONTOUR::CreateWing().
00862 { 00863 BREP_WING* wing = NULL; 00864 00865 // vertex1 - vertex2 間にエッジが既に登録されているかどうかチェックする. 00866 BREP_EDGE* edge = FindEdge(vertex1, vertex2); 00867 if (edge==NULL) { // Edgeは存在しない. 00868 edge = CreateEdge(vertex1, vertex2); 00869 if (edge==NULL) return NULL; // vertex1==vertex2 なら NULL 00870 wing = edge->wing1; 00871 } 00872 else{ // Edgeは既に存在する. 00873 if (edge->wing1->vertex==vertex1) wing = edge->wing1; 00874 else if (edge->wing2->vertex==vertex1) wing = edge->wing2; 00875 00876 // Wingが既に Contourで使われている場合,他の Wingを探す. 00877 if (edge->edge_list!=NULL && wing!=NULL && wing->contour!=NULL) { 00878 BREP_EDGE_LIST::iterator iedge=edge->edge_list->begin(); 00879 while (iedge!=edge->edge_list->end() && wing->contour!=NULL) { 00880 if ((*iedge)->wing1->vertex==vertex1) wing = (*iedge)->wing1; 00881 else if ((*iedge)->wing2->vertex==vertex1) wing = (*iedge)->wing2; 00882 iedge++; 00883 } 00884 } 00885 00886 // このWingは既に Contourで使われているか? 00887 if (wing!=NULL && wing->contour!=NULL){ 00888 // 新しくEdgeを作り直す 00889 BREP_EDGE* new_edge = CreateEdge(vertex1, vertex2); 00890 if (new_edge==NULL) return NULL; 00891 00892 if (edge->edge_list==NULL) { 00893 edge->edge_list = new BREP_EDGE_LIST(); 00894 edge->edge_list->push_back(edge); 00895 } 00896 edge->edge_list->push_back(new_edge); 00897 new_edge->edge_list = edge->edge_list; 00898 wing = new_edge->wing1; 00899 } 00900 } 00901 00902 return wing; 00903 }
MSGraph<T> jbxl::cut_object_MSGraph | ( | MSGraph< T > | vp, | |
RBound< int > | rb, | |||
bool | ecnt = false | |||
) | [inline] |
template <typename t>=""> MSGraph<T> cut_object_MSGraph(MSGraph<T> vp, RBound<int> rb, bool ecnt=false)
グラフィックデータから rbound の範囲を抜き出す.
vp | 操作対象となるグラフィックデータ構造体. | |
rb | 切り抜き対象の範囲 | |
ecnt | カウンタを使用するかどうか.デフォルトは false |
Definition at line 1687 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::color, RBound< T >::commonarea(), RBound< T >::cutdown(), GetUsableGlobalCounter(), MSGraph< T >::gp, MSGraph< T >::init(), CVCounter::isCanceled(), MSGraph< T >::isNull(), JBXL_GRAPH_CANCEL, JBXL_GRAPH_MEMORY_ERROR, Max, MSGraph< T >::max, Min, MSGraph< T >::min, MSGraph< T >::rbound, MSGraph< T >::RZxy, MSGraph< T >::set(), CVCounter::SetMax(), MSGraph< T >::state, CVCounter::StepIt(), RBound< T >::xmax, RBound< T >::xmin, MSGraph< T >::xs, RBound< T >::ymax, RBound< T >::ymin, MSGraph< T >::ys, MSGraph< T >::zero, RBound< T >::zmax, RBound< T >::zmin, and MSGraph< T >::zs.
01688 { 01689 int i, j, k; 01690 int cx, cy, cz, cp; 01691 int ax, ay, az, ap; 01692 MSGraph<T> xp; // = new MSGraph<T>(); 01693 01694 xp.init(); 01695 RBound<int> rx(0, vp.xs-1, 0, vp.ys-1, 0, vp.zs-1); 01696 CVCounter* counter = NULL; 01697 01698 if (ecnt) counter = GetUsableGlobalCounter(); 01699 if (counter!=NULL) { 01700 if (counter->isCanceled()) { 01701 xp.state = JBXL_GRAPH_CANCEL; 01702 return xp; 01703 } 01704 counter->SetMax(vp.zs*2); 01705 } 01706 01707 rb.commonarea(rx); 01708 xp.set(rb.xmax-rb.xmin+1, rb.ymax-rb.ymin+1, rb.zmax-rb.zmin+1, vp.zero, vp.base, vp.RZxy); 01709 if (xp.isNull()) { 01710 xp.state = JBXL_GRAPH_MEMORY_ERROR; 01711 return xp; 01712 } 01713 xp.rbound = rb; 01714 xp.color = vp.color; 01715 01716 ap = vp.xs*vp.ys; 01717 cp = xp.xs*xp.ys; 01718 01719 for (k=0; k<xp.zs; k++) { 01720 cz = cp*k; 01721 az = ap*(k+rb.zmin); 01722 for (j=0; j<xp.ys; j++) { 01723 cy = cz + xp.xs*j; 01724 ay = az + vp.xs*(j+rb.ymin); 01725 for (i=0; i<xp.xs; i++) { 01726 cx = cy + i; 01727 ax = ay + i + rb.xmin; 01728 xp.gp[cx] = vp.gp[ax]; 01729 01730 if (cx==0) xp.max = xp.min = xp.gp[cx]; 01731 else { 01732 xp.max = Max(xp.max, xp.gp[cx]); 01733 xp.min = Min(xp.min, xp.gp[cx]); 01734 } 01735 } 01736 } 01737 01738 // Counter 01739 if (counter!=NULL) { 01740 counter->StepIt(); 01741 if (counter->isCanceled()) { 01742 xp.state = JBXL_GRAPH_CANCEL; 01743 return xp; 01744 } 01745 } 01746 } 01747 xp.rbound.cutdown(vp.rbound); 01748 01749 return xp; 01750 }
MSGraph<T> jbxl::cut_object_MSGraph | ( | MSGraph< T > | vp, | |
int | mn, | |||
int | mx, | |||
RBound< int > | rbound, | |||
int | blank = BOUNDARY_BLANK , |
|||
bool | ecnt = false | |||
) | [inline] |
template <typename t>=""> MSGraph<T> cut_object_MSGraph(MSGraph<T> vp, int mn, int mx, RBound<int> rbound, int blank=BOUNDARY_BLANK, bool ecnt=false)
グラフィックデータから rboundの範囲で mn〜mx の輝度値を持つ部分を抜き出す.
vp | 操作対象となるグラフィックデータ構造体. | |
mn | 抜き出す画像の輝度値の最小値. | |
mx | 抜き出す画像の輝度値の最大値. | |
rbound | 切り抜き対象の範囲 | |
blank | 境界の余白.余裕. | |
ecnt | カウンタを使用するかどうか.デフォルトは false |
Definition at line 1577 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::color, RBound< T >::commonarea(), RBound< T >::cutdown(), RBound< T >::enlarge(), RBound< T >::fusion(), GetUsableGlobalCounter(), MSGraph< T >::gp, MSGraph< T >::init(), CVCounter::isCanceled(), MSGraph< T >::isNull(), JBXL_GRAPH_CANCEL, JBXL_GRAPH_MEMORY_ERROR, JBXL_GRAPH_NODATA_ERROR, Max, MSGraph< T >::max, Min, MSGraph< T >::min, MSGraph< T >::rbound, MSGraph< T >::RZxy, MSGraph< T >::set(), CVCounter::SetMax(), MSGraph< T >::state, CVCounter::StepIt(), RBound< T >::xmax, RBound< T >::xmin, MSGraph< T >::xs, RBound< T >::ymax, RBound< T >::ymin, MSGraph< T >::ys, MSGraph< T >::zero, RBound< T >::zmax, RBound< T >::zmin, and MSGraph< T >::zs.
01578 { 01579 int i, j, k, n; 01580 int cx, cy, cz, cp; 01581 int ax, ay, az, ap; 01582 MSGraph<T> xp; // = new MSGraph<T>(); 01583 01584 xp.init(); 01585 RBound<int> rb(vp.xs-1, 0, vp.ys-1, 0, vp.zs-1, 0); 01586 RBound<int> rx(0, vp.xs-1, 0, vp.ys-1, 0, vp.zs-1); 01587 CVCounter* counter = NULL; 01588 01589 if (ecnt) counter = GetUsableGlobalCounter(); 01590 if (counter!=NULL) { 01591 if (counter->isCanceled()) { 01592 xp.state = JBXL_GRAPH_CANCEL; 01593 return xp; 01594 } 01595 counter->SetMax(vp.zs*2); 01596 } 01597 01598 rbound.commonarea(rx); 01599 ap = vp.xs*vp.ys; 01600 n = 0; 01601 for (k=rbound.zmin; k<=rbound.zmax; k++) { 01602 az = ap*k; 01603 for (j=rbound.ymin; j<=rbound.ymax; j++) { 01604 ay = az + vp.xs*j; 01605 for (i=rbound.xmin; i<=rbound.xmax; i++) { 01606 ax = ay + i; 01607 if (vp.gp[ax]>=(T)mn && vp.gp[ax]<=(T)mx) { 01608 n++; 01609 rb.fusion(i, j, k); 01610 } 01611 } 01612 } 01613 01614 // Counter 01615 if (counter!=NULL) { 01616 counter->StepIt(); 01617 if (counter->isCanceled()) { 01618 xp.state = JBXL_GRAPH_CANCEL; 01619 return xp; 01620 } 01621 } 01622 } 01623 01624 if (n==0) { 01625 xp.state = JBXL_GRAPH_NODATA_ERROR; 01626 return xp; 01627 } 01628 01629 if (blank>0) rb.enlarge(blank); 01630 rb.commonarea(rbound); 01631 01632 xp.set(rb.xmax-rb.xmin+1, rb.ymax-rb.ymin+1, rb.zmax-rb.zmin+1, vp.zero, vp.base, vp.RZxy); 01633 if (xp.isNull()) { 01634 xp.state = JBXL_GRAPH_MEMORY_ERROR; 01635 return xp; 01636 } 01637 xp.rbound = rb; 01638 xp.min = (T)mx; 01639 xp.max = (T)mn; 01640 xp.color = vp.color; 01641 01642 cp = xp.xs*xp.ys; 01643 for (k=0; k<xp.zs; k++) { 01644 cz = cp*k; 01645 az = ap*(k+rb.zmin); 01646 for (j=0; j<xp.ys; j++) { 01647 cy = cz + xp.xs*j; 01648 ay = az + vp.xs*(j+rb.ymin); 01649 for (i=0; i<xp.xs; i++) { 01650 cx = cy + i; 01651 ax = ay + i + rb.xmin; 01652 if (vp.gp[ax]>=(T)mn && vp.gp[ax]<=(T)mx) { 01653 xp.gp[cx] = vp.gp[ax]; 01654 xp.max = Max(xp.max, xp.gp[cx]); 01655 xp.min = Min(xp.min, xp.gp[cx]); 01656 } 01657 } 01658 } 01659 01660 // Counter 01661 if (counter!=NULL) { 01662 counter->StepIt(); 01663 if (counter->isCanceled()) { 01664 xp.state = JBXL_GRAPH_CANCEL; 01665 return xp; 01666 } 01667 } 01668 } 01669 xp.rbound.cutdown(vp.rbound); 01670 01671 return xp; 01672 }
MSGraph<T> jbxl::cut_object_MSGraph | ( | MSGraph< T > | vp, | |
int | mn, | |||
int | mx, | |||
int | blank = BOUNDARY_BLANK , |
|||
bool | ecnt = false | |||
) | [inline] |
template <typename t>=""> MSGraph<T> cut_object_MSGraph(MSGraph<T> vp, int mn, int mx, int blank=BOUNDARY_BLANK, bool ecnt=false)
グラフィックデータから mn〜mx の輝度値を持つ部分を抜き出す.
vp | 操作対象となるグラフィックデータ構造体. | |
mn | 抜き出す画像の輝度値の最小値. | |
mx | 抜き出す画像の輝度値の最大値. | |
blank | 境界の余白.あそび. | |
ecnt | カウンタを使用するかどうか.デフォルトは false |
Definition at line 1464 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::color, RBound< T >::commonarea(), RBound< T >::cutdown(), RBound< T >::enlarge(), RBound< T >::fusion(), GetUsableGlobalCounter(), MSGraph< T >::gp, MSGraph< T >::init(), CVCounter::isCanceled(), MSGraph< T >::isNull(), JBXL_GRAPH_CANCEL, JBXL_GRAPH_MEMORY_ERROR, JBXL_GRAPH_NODATA_ERROR, Max, MSGraph< T >::max, Min, MSGraph< T >::min, MSGraph< T >::rbound, MSGraph< T >::RZxy, MSGraph< T >::set(), CVCounter::SetMax(), MSGraph< T >::state, CVCounter::StepIt(), RBound< T >::xmax, RBound< T >::xmin, MSGraph< T >::xs, RBound< T >::ymax, RBound< T >::ymin, MSGraph< T >::ys, MSGraph< T >::zero, RBound< T >::zmax, RBound< T >::zmin, and MSGraph< T >::zs.
01465 { 01466 int i, j, k, n; 01467 int cx, cy, cz, cp; 01468 int ax, ay, az, ap; 01469 MSGraph<T> xp; // = new MSGraph<T>(); 01470 01471 xp.init(); 01472 RBound<int> rb(vp.xs-1, 0, vp.ys-1, 0, vp.zs-1, 0); 01473 RBound<int> rx(0, vp.xs-1, 0, vp.ys-1, 0, vp.zs-1); 01474 CVCounter* counter = NULL; 01475 01476 if (ecnt) counter = GetUsableGlobalCounter(); 01477 if (counter!=NULL) { 01478 if (counter->isCanceled()) { 01479 xp.state = JBXL_GRAPH_CANCEL; 01480 return xp; 01481 } 01482 counter->SetMax(vp.zs*2); 01483 } 01484 01485 ap = vp.xs*vp.ys; 01486 n = 0; 01487 for (k=0; k<vp.zs; k++) { 01488 az = ap*k; 01489 for (j=0; j<vp.ys; j++) { 01490 ay = az + vp.xs*j; 01491 for (i=0; i<vp.xs; i++) { 01492 ax = ay + i; 01493 if (vp.gp[ax]>=(T)mn && vp.gp[ax]<=(T)mx) { 01494 n++; 01495 rb.fusion(i, j, k); 01496 } 01497 } 01498 } 01499 01500 // Counter 01501 if (counter!=NULL) { 01502 counter->StepIt(); 01503 if (counter->isCanceled()) { 01504 xp.state = JBXL_GRAPH_CANCEL; 01505 return xp; 01506 } 01507 } 01508 } 01509 01510 if (n==0) { 01511 xp.state = JBXL_GRAPH_NODATA_ERROR; 01512 return xp; 01513 } 01514 01515 if (blank>0) rb.enlarge(blank); 01516 rb.commonarea(rx); 01517 01518 xp.set(rb.xmax-rb.xmin+1, rb.ymax-rb.ymin+1, rb.zmax-rb.zmin+1, vp.zero, vp.base, vp.RZxy); 01519 if (xp.isNull()) { 01520 xp.state = JBXL_GRAPH_MEMORY_ERROR; 01521 return xp; 01522 } 01523 xp.rbound = rb; 01524 xp.min = (T)mx; 01525 xp.max = (T)mn; 01526 xp.color = vp.color; 01527 01528 cp = xp.xs*xp.ys; 01529 for (k=0; k<xp.zs; k++) { 01530 cz = cp*k; 01531 az = ap*(k+rb.zmin); 01532 for (j=0; j<xp.ys; j++) { 01533 cy = cz + xp.xs*j; 01534 ay = az + vp.xs*(j+rb.ymin); 01535 for (i=0; i<xp.xs; i++) { 01536 cx = cy + i; 01537 ax = ay + (i+rb.xmin); 01538 if (vp.gp[ax]>=(T)mn && vp.gp[ax]<=(T)mx) { 01539 xp.gp[cx] = vp.gp[ax]; 01540 xp.max = Max(xp.max, xp.gp[cx]); 01541 xp.min = Min(xp.min, xp.gp[cx]); 01542 } 01543 } 01544 } 01545 01546 // Counter 01547 if (counter!=NULL) { 01548 counter->StepIt(); 01549 if (counter->isCanceled()) { 01550 xp.state = JBXL_GRAPH_CANCEL; 01551 return xp; 01552 } 01553 } 01554 } 01555 01556 xp.rbound.cutdown(vp.rbound); 01557 01558 return xp; 01559 }
rectangle* jbxl::cvDetectObjects | ( | cv::CascadeClassifier | cascade, | |
MSGraph< T > * | vp, | |||
int & | num, | |||
int | sz = 0 , |
|||
double | scale = 1.0 | |||
) | [inline] |
cascade | 識別エンジン | |
vp | 1plane(channel) MSGraphデータ(つまりモノクロ)へのポインタ | |
[out] | num | 要素の数 |
sz | 検出する最小のサイズ | |
scale | 縮小スケール |
Definition at line 67 of file OpenCVTool.h.
00068 { 00069 num = 0; 00070 00071 cv::Mat imag = copyMSGraph2CvMat<uByte>(vp); 00072 cv::equalizeHist(imag, imag); 00073 00074 cv::Mat simg = imag; 00075 if (scale>1.0) { 00076 simg = cv::Mat_<uByte>((int)(imag.rows/scale), (int)(imag.cols/scale)); 00077 cv::resize(imag, simg, simg.size(), 0, 0, cv::INTER_LINEAR); 00078 } 00079 else scale = 1.0; 00080 00081 std::vector<cv::Rect> faces; 00082 if (sz>1) cascade.detectMultiScale(simg, faces, 1.1, 3, 0, cv::Size(sz, sz)); 00083 else cascade.detectMultiScale(simg, faces); 00084 00085 num = (int)faces.size(); 00086 if (num==0) return NULL; 00087 00088 int len = sizeof(rectangle)*num; 00089 rectangle* data = (rectangle*)malloc(len); 00090 if (data==NULL) return NULL; 00091 memset(data, 0, len); 00092 00093 int n = 0; 00094 std::vector<cv::Rect>::const_iterator r; 00095 for (r=faces.begin(); r!=faces.end(); r++) { 00096 data[n].x = (int)(r->x*scale); 00097 data[n].y = (int)(r->y*scale); 00098 data[n].xsize = (int)(r->width *scale); 00099 data[n].ysize = (int)(r->height*scale); 00100 n++; 00101 } 00102 00103 return data; 00104 }
void jbxl::del_tList_object | ( | tList ** | lp | ) | [inline] |
Definition at line 86 of file tools++.h.
References del_tList().
00087 { 00088 tList* lt = *lp; 00089 00090 while(lt!=NULL) { 00091 T* pp = (T*)lt->ldat.ptr; 00092 pp->free(); 00093 delete(pp); 00094 lt->ldat.ptr = NULL; 00095 lt->ldat.sz = 0; 00096 lt = lt->next; 00097 } 00098 del_tList(lp); 00099 }
bool deletable | ( | MSGraph< T > | vp, | |
int | n, | |||
int | c, | |||
int | d | |||
) | [inline] |
template <typename t>=""> bool deletable(MSGraph<T> vp, int n, int c, int d)
n で示されるボクセルが削除可能かどうか判定する.
vp | 画像データ | |
n | ボクセルのID | |
c | 近傍数 | |
d | 次元数 |
Definition at line 272 of file Thinning.h.
References connectNumber(), DEBUG_MODE, deletable_4(), deletable_5(), deletable_s(), MSGraph< T >::gp, PRINT_MESG, MSGraph< T >::xs, and MSGraph< T >::ys.
Referenced by centerLine().
00273 { 00274 int i, j, k, l, m, lz, ly, mz, my; 00275 int cn, mm, nh; 00276 int v[27]; 00277 bool ret; 00278 00279 if (d<3) { // 2D- YET NO IMPLIMENT 00280 mm = 9; 00281 for (j=-1; j<=1; j++) { 00282 ly = (j+1)*3; 00283 my = n + j*vp.xs; 00284 for (i=-1; i<=1; i++) { 00285 l = ly + (i+1); 00286 m = my + i; 00287 if (vp.gp[m]!=0) v[l] = 1; 00288 else v[l] = 0; 00289 } 00290 } 00291 DEBUG_MODE PRINT_MESG("DELETABLE: 2D mode is not supported.\n"); 00292 return false; 00293 } 00294 else { // for 3D 00295 mm = 27; 00296 for (k=-1; k<=1; k++) { 00297 lz = (k+1)*9; 00298 mz = n + k*vp.xs*vp.ys; 00299 for (j=-1; j<=1; j++) { 00300 ly = lz + (j+1)*3; 00301 my = mz + j*vp.xs; 00302 for (i=-1; i<=1; i++) { 00303 l = ly + (i+1); 00304 m = my + i; 00305 if (vp.gp[m]>0) v[l] = 1; 00306 else v[l] = 0; 00307 } 00308 } 00309 } 00310 } 00311 00312 cn = connectNumber(v, c, d); 00313 if (cn==-1 || cn!=1) return false; 00314 00315 if (c==26 || c==8) { 00316 v[c/2] = 1 - v[c/2]; 00317 for(i=0; i<mm; i++) v[i] = 1 - v[i]; 00318 } 00319 00320 nh = v[10] + v[12] + v[14] + v[16] + v[4] + v[22]; 00321 if (nh<=3) ret = true; 00322 else if (nh==4) ret = deletable_s(v); 00323 else if (nh==5) ret = deletable_4(v); 00324 else if (nh==6) ret = deletable_5(v); 00325 00326 return ret; 00327 }
bool deletable_4 | ( | int * | v | ) |
Definition at line 107 of file Thinning.cpp.
References deletable_s().
Referenced by deletable().
00108 { 00109 int i, w[6], u[6]; 00110 00111 bool ret = deletable_s(v); 00112 if (!ret) return false; 00113 00114 u[0] = v[ 4]; 00115 u[1] = v[10]; 00116 u[2] = v[12]; 00117 u[3] = v[14]; 00118 u[4] = v[16]; 00119 u[5] = v[22]; 00120 00121 for(i=0; i<6; i++) w[i] = 0; 00122 00123 if (v[ 1]==1) w[0] = w[1] = 1; 00124 if (v[ 3]==1) w[0] = w[2] = 1; 00125 if (v[ 5]==1) w[0] = w[3] = 1; 00126 if (v[ 7]==1) w[0] = w[4] = 1; 00127 if (v[ 9]==1) w[1] = w[2] = 1; 00128 if (v[11]==1) w[1] = w[3] = 1; 00129 if (v[15]==1) w[2] = w[4] = 1; 00130 if (v[17]==1) w[3] = w[4] = 1; 00131 if (v[19]==1) w[1] = w[5] = 1; 00132 if (v[21]==1) w[2] = w[5] = 1; 00133 if (v[23]==1) w[3] = w[5] = 1; 00134 if (v[25]==1) w[4] = w[5] = 1; 00135 00136 ret = true; 00137 for(i=0; i<6; i++) if (w[i]==0 && u[i]==1) ret = false; 00138 00139 return ret; 00140 }
bool deletable_5 | ( | int * | v | ) |
Definition at line 143 of file Thinning.cpp.
Referenced by deletable().
00144 { 00145 int i, j, k, m, s; 00146 int mz[6][6], mx[6][6], mm[6][6]; 00147 00148 mm[0][1] = mm[1][0] = v[ 3]; 00149 mm[0][2] = mm[2][0] = v[ 7]; 00150 mm[0][3] = mm[3][0] = v[ 1]; 00151 mm[0][4] = mm[4][0] = v[ 5]; 00152 mm[1][2] = mm[2][1] = v[15]; 00153 mm[1][3] = mm[3][1] = v[ 9]; 00154 mm[1][5] = mm[5][1] = v[21]; 00155 mm[2][4] = mm[4][2] = v[17]; 00156 mm[2][5] = mm[5][2] = v[25]; 00157 mm[3][4] = mm[4][3] = v[11]; 00158 mm[3][5] = mm[5][3] = v[19]; 00159 mm[4][5] = mm[5][4] = v[23]; 00160 00161 for(i=0; i<6; i++) { // I+M 00162 for(j=0; j<6; j++) { 00163 mx[i][j] = mm[i][j]; 00164 if (i==j) mx[i][i]++; 00165 } 00166 } 00167 00168 for(i=0; i<6; i++) { // M(I+M) 00169 for(j=0; j<6; j++) { 00170 m = 0; 00171 for(k=0; k<6; k++) { 00172 m = m + mm[i][k]*mx[k][j]; 00173 } 00174 mz[i][j] = m; 00175 } 00176 } 00177 00178 for(i=0; i<6; i++) { // I+M(I+M) 00179 mz[i][i] = 1 + mz[i][i]; 00180 } 00181 00182 for(i=0; i<6; i++) { // M(I+M(I+M)) 00183 for(j=0; j<6; j++) { 00184 m = 0; 00185 for(k=0; k<6; k++) { 00186 m = m + mm[i][k]*mz[k][j]; 00187 } 00188 mx[i][j] = m; 00189 } 00190 } 00191 00192 for(i=0; i<6; i++) { // I+M(I+M(I+M)) 00193 mx[i][i] = 1 + mx[i][i]; 00194 } 00195 00196 for(i=0; i<6; i++) { // M(I+M(I+M(I+M))) 00197 for(j=0; j<6; j++) { 00198 m = 0; 00199 for(k=0; k<6; k++) { 00200 m = m + mm[i][k]*mx[k][j]; 00201 } 00202 mz[i][j] = m; 00203 } 00204 } 00205 00206 for(i=0; i<6; i++) { // I+M(I+M(I+M(I+M))) 00207 mz[i][i] = 1 + mz[i][i]; 00208 } 00209 00210 s = 1; 00211 for(i=0; i<6; i++) { // M(I+M(I+M(I+M(I+M)))) 00212 for(j=0; j<6; j++) { 00213 m = 0; 00214 for(k=0; k<6; k++) { 00215 m = m + mm[i][k]*mz[k][j]; 00216 } 00217 s = s*m; 00218 } 00219 } 00220 00221 if (s==0) return false; 00222 else return true; 00223 }
bool deletable_s | ( | int * | v | ) |
Definition at line 89 of file Thinning.cpp.
Referenced by deletable(), and deletable_4().
00090 { 00091 int s; 00092 00093 s = (1-v[ 6])*v[ 3]*v[ 7]*v[ 4]*v[12]*v[15]*v[16] + 00094 (1-v[ 8])*v[ 7]*v[ 5]*v[ 4]*v[16]*v[17]*v[14] + 00095 (1-v[ 2])*v[ 5]*v[ 1]*v[ 4]*v[14]*v[11]*v[10] + 00096 (1-v[ 0])*v[ 1]*v[ 3]*v[ 4]*v[10]*v[ 9]*v[12] + 00097 (1-v[24])*v[21]*v[25]*v[22]*v[12]*v[15]*v[16] + 00098 (1-v[26])*v[25]*v[23]*v[22]*v[16]*v[17]*v[14] + 00099 (1-v[20])*v[23]*v[19]*v[22]*v[14]*v[11]*v[10] + 00100 (1-v[18])*v[19]*v[21]*v[22]*v[10]*v[ 9]*v[12]; 00101 00102 if (s==1) return false; 00103 else return true; 00104 }
void jbxl::delete_noise_MSGraph | ( | MSGraph< T > | vp, | |
int | size, | |||
int | mode = 8 , |
|||
int | work_color = 0 | |||
) | [inline] |
template <typename t>=""> void delete_noise_MSGraph(MSGraph<T> vp, int size, int mode=8, int work_color=0)
背景(vp.zero)に浮かぶ孤立ノイズを除去する.
-work_color〜-1, work_color〜 を作業領域として使用するので,この区間にデータがある場合は誤作動する.
Definition at line 2484 of file Graph.h.
References addPaint_MSGraph(), MSGraph< T >::get_minmax(), MSGraph< T >::gp, MSGraph< T >::max, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zero.
02485 { 02486 int i, j, k; 02487 int num, ps ,pp; 02488 02489 ps = vp.xs*vp.ys; 02490 if (work_color==0) { 02491 if (vp.max==0 || vp.max==vp.zero) vp.get_minmax(); 02492 work_color = vp.max + 1; 02493 } 02494 02495 for(j=0; j<vp.ys; j++) { 02496 pp = j*vp.xs; 02497 for(i=0; i<vp.xs; i++) { 02498 if (vp.gp[i+pp]>vp.zero && vp.gp[i+pp]<work_color) { 02499 num = addPaint_MSGraph(vp, i, j, 1, work_color-1, work_color, mode); 02500 if (num<=size) { 02501 int n = 0; 02502 for (k=i+pp; k<ps; k++) { 02503 if (vp.gp[k]>=work_color) { 02504 vp.gp[k] = vp.zero; 02505 n++; 02506 if (n>=num) break; 02507 } 02508 } 02509 } 02510 else { 02511 int n = 0; 02512 for (k=i+pp; k<ps; k++) { 02513 if (vp.gp[k]>=work_color) { 02514 vp.gp[k] = -vp.gp[k]; 02515 n++; 02516 if (n>=num) break; 02517 } 02518 } 02519 } 02520 } 02521 } 02522 } 02523 02524 for (i=0; i<ps; i++) { 02525 if (vp.gp[i]<vp.zero) vp.gp[i] = - vp.gp[i] - work_color; 02526 } 02527 }
void jbxl::deleteNull | ( | T & | p | ) | [inline] |
Definition at line 45 of file common++.h.
Referenced by BrepSolidList::addSolid(), AddVector2TriSolid(), CreateTriSolidFromSTL(), CreateTriSolidFromVector(), and BrepSolidList::getMerge().
DllExport void DeleteShortageWings | ( | BREP_SOLID * | solid | ) |
void jbxl::DeleteShortageWings(BREP_SOLID* solid)
不完全 Wing(Edge)を持つFacet(Contour)を削除
Contours List と Wings Listの内容は保障される.
Definition at line 258 of file TriBrep.cpp.
References BREP_WING::contour, BREP_SOLID::counter, CreateContoursList(), CreateWingsList(), BREP_FACET::deletable, BREP_CONTOUR::facet, CVCounter::GetUsableCounter(), GetWingOtherSide(), CVCounter::SetMax(), BREP_SOLID::shortage_wings, and CVCounter::StepIt().
00259 { 00260 if (solid->shortage_wings.empty()) return; 00261 // DEBUG_MODE PRINT_MESG("Start DeleteShortageWings\n"); 00262 00263 CVCounter* counter = NULL; 00264 if (solid->counter!=NULL) counter = solid->counter->GetUsableCounter(); 00265 if (counter!=NULL) counter->SetMax((int)solid->shortage_wings.size()); 00266 00267 BREP_WING_LIST::iterator iwing; 00268 for (iwing=solid->shortage_wings.begin(); iwing!=solid->shortage_wings.end(); iwing++){ 00269 if ((*iwing)->contour!=NULL) (*iwing)->contour->facet->deletable = true; 00270 BREP_WING* othwing = GetWingOtherSide(*iwing); 00271 if (othwing->contour!=NULL) othwing->contour->facet->deletable = true; 00272 if (counter!=NULL) counter->StepIt(); 00273 } 00274 00275 CreateContoursList(solid); 00276 CreateWingsList(solid); 00277 // DEBUG_MODE PRINT_MESG("End DeleteShortageWings\n"); 00278 return; 00279 }
DllExport void DeleteStraightEdges | ( | BREP_SOLID * | solid | ) |
void jbxl::DeleteStraightEdges(BREP_SOLID* solid)
複数のVertexが直線に並んだ場合,両端のVertex間に作られた Edge(Wing)に関連する Contour(Facet)を削除.
Contours List と Wings Listの内容は保障される.
Definition at line 217 of file TriBrep.cpp.
References BREP_SOLID::counter, CreateContoursList(), CreateWingsList(), CVCounter::GetUsableCounter(), GetWingOtherSide(), IsConnectEdges(), IsForbiddenEdge(), CVCounter::SetMax(), BREP_SOLID::shortage_wings, CVCounter::StepIt(), and BREP_WING::vertex.
Referenced by CloseTriSolid().
00218 { 00219 if (solid->shortage_wings.empty()) return; 00220 // DEBUG_MODE PRINT_MESG("Start DeleteStraightEdges\n"); 00221 00222 CVCounter* counter = NULL; 00223 if (solid->counter!=NULL) counter = solid->counter->GetUsableCounter(); 00224 if (counter!=NULL) counter->SetMax((int)solid->shortage_wings.size()); 00225 00226 BREP_WING_LIST::iterator wing1; 00227 for (wing1=solid->shortage_wings.begin(); wing1!=solid->shortage_wings.end(); wing1++){ 00228 BREP_VERTEX* vert[3]; 00229 vert[0] = (*wing1)->vertex; 00230 BREP_WING_LIST::iterator wing2; 00231 for (wing2=solid->shortage_wings.begin(); wing2!=solid->shortage_wings.end(); wing2++){ 00232 if (IsConnectEdges(*wing1, *wing2)) { 00233 vert[1] = (*wing2)->vertex; 00234 vert[2] = GetWingOtherSide(*wing2)->vertex; 00235 IsForbiddenEdge(vert); // 直線に並んだ Vertexを禁止する. 00236 } 00237 } 00238 if (counter!=NULL) counter->StepIt(); 00239 } 00240 CreateContoursList(solid); // 該当Contour(Facet)を削除し,全てのContour(Facet)の Listを作り直す. 00241 CreateWingsList(solid); // WingsListを作り直す. 00242 00243 // DEBUG_MODE PRINT_MESG("End DeleteStraightEdges\n"); 00244 return; 00245 }
DllExport void DeleteSurplusContours | ( | BREP_SOLID * | solid | ) |
void jbxl::DeleteSurplusContours(BREP_SOLID* solid)
多重Edgeを持つ Contour(Facet)の削除
Contours List と Wings Listの内容は保障される.
Definition at line 146 of file TriBrep.cpp.
References BREP_SOLID::counter, CreateShortageWingsList(), CreateSurplusContoursList(), CVCounter::GetUsableCounter(), JoinShortageWings(), ReverseContours(), CVCounter::SetMax(), CVCounter::StepIt(), and BREP_SOLID::surplus_contours.
Referenced by CloseTriSolid().
00147 { 00148 if (solid->surplus_contours.empty()) return; 00149 // DEBUG_MODE PRINT_MESG("Start DeleteSurplusContours\n"); 00150 00151 CVCounter* counter = NULL; 00152 if (solid->counter!=NULL) counter = solid->counter->GetUsableCounter(); 00153 if (counter!=NULL) counter->SetMax((int)solid->surplus_contours.size()*3); 00154 00155 BREP_CONTOUR_LIST::iterator icon; 00156 // 3つの多重Edgeを持つ Facetの処理 00157 for (icon=solid->surplus_contours.begin(); icon!=solid->surplus_contours.end(); icon++){ 00158 if ((*icon)->dup_edge==3) (*icon)->facet->deletable = true; 00159 if (counter!=NULL) counter->StepIt(); 00160 } 00161 ReverseContours(solid); // 3辺が多重Edgeの Facetを裏返す 00162 CreateShortageWingsList(solid); 00163 JoinShortageWings(solid); // 一つにまとまるEdgeは一つにまとめる. 00164 00165 CreateSurplusContoursList(solid); 00166 if (solid->surplus_contours.empty()) { 00167 // DEBUG_MODE PRINT_MESG("End DeleteSurplusContours\n"); 00168 return; 00169 } 00170 00171 // 2つの多重Edgeを持つ Facetの処理 00172 for (icon=solid->surplus_contours.begin(); icon!=solid->surplus_contours.end(); icon++){ 00173 if ((*icon)->dup_edge==2) (*icon)->facet->deletable = true; 00174 if (counter!=NULL) counter->StepIt(); 00175 } 00176 ReverseContours(solid); // 2辺が多重Edgeの Facetを裏返す 00177 CreateShortageWingsList(solid); 00178 JoinShortageWings(solid); 00179 00180 CreateSurplusContoursList(solid); 00181 if (solid->surplus_contours.empty()) { 00182 // DEBUG_MODE PRINT_MESG("End DeleteSurplusContours\n"); 00183 return; 00184 } 00185 00186 // 1つの多重Edgeを持つ Facetの処理 00187 for (icon=solid->surplus_contours.begin(); icon!=solid->surplus_contours.end(); icon++){ 00188 if ((*icon)->dup_edge==1) (*icon)->facet->deletable = true; 00189 if (counter!=NULL) counter->StepIt(); 00190 } 00191 ReverseContours(solid); // 1辺が多重Edgeの Facetを裏返す 00192 CreateShortageWingsList(solid); 00193 JoinShortageWings(solid); 00194 00195 CreateSurplusContoursList(solid); 00196 if (!solid->surplus_contours.empty()) { 00197 // DEBUG_MODE PRINT_MESG("EraseSurplusContour: 多重Edgeを持つ Facetデータが残っている?\n"); 00198 } 00199 // DEBUG_MODE PRINT_MESG("End DeleteSurplusContours\n"); 00200 return; 00201 }
MeshObjectNode * DelMeshObjectNode | ( | MeshObjectNode * | node | ) |
Definition at line 394 of file MeshObjectData.cpp.
References freeMeshObjectNode(), MeshObjectNode::next, and MeshObjectNode::prev.
00395 { 00396 if (node==NULL) return NULL; 00397 00398 if (node->prev!=NULL) node->prev->next = node->next; 00399 if (node->next!=NULL) node->next->prev = node->prev; 00400 00401 MeshObjectNode* next = node->next; 00402 freeMeshObjectNode(node); 00403 00404 return next; 00405 }
MSGraph<T> jbxl::Density_Filter | ( | MSGraph< T > | vp, | |
int | size, | |||
double | rate, | |||
int | mode = 8 , |
|||
int | work_color = 0 | |||
) | [inline] |
template <typename t>=""> MSGraph<T> Density_Filter(MSGraph<T> vp, int size, double rate, int mode=8, int work_color=0)
密度フィルター
画像データの密度マスクを適用して返す.
vp | 画像データ | |
size | マスクのサイズ | |
rate | 密度の閾値 | |
mode | 近傍(4 or 8) | |
work_color | 作業用輝度値 |
Definition at line 2426 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::free(), MSGraph< T >::get_minmax(), MSGraph< T >::gp, MSGraph< T >::max, MSGraph< T >::mimicry(), MSGraph< T >::set(), MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zero.
02427 { 02428 MSGraph<T> pp, xp, wp; 02429 int hsize = size/2; 02430 02431 if (work_color==0) { 02432 if (vp.max==0 || vp.max==vp.zero) vp.get_minmax(); 02433 work_color = vp.max + 1; 02434 } 02435 02436 if (hsize==0) hsize = 1; 02437 size = hsize*2 + 1; 02438 pp.set(size, size, 1, vp.zero, vp.base); 02439 wp.mimicry(vp); 02440 02441 for (int j=hsize; j<vp.ys-hsize; j++) { 02442 for (int i=hsize; i<vp.xs-hsize; i++) { 02443 02444 for (int m=-hsize; m<=hsize; m++) { 02445 int vx = (m+j)*vp.xs + i; 02446 int px = (m+hsize)*pp.xs + hsize; 02447 02448 for (int n=-hsize; n<=hsize; n++) { 02449 pp.gp[px+n] = vp.gp[vx+n]; 02450 } 02451 } 02452 02453 xp = Density_Mask<T>(pp, rate, mode, work_color); 02454 02455 if (xp.state!=0) { 02456 for (int m=-hsize; m<=hsize; m++) { 02457 int wx = (m+j)*wp.xs + i; 02458 int xx = (m+hsize)*xp.xs + hsize; 02459 02460 for (int n=-hsize; n<=hsize; n++) { 02461 if (xp.gp[xx+n]!=vp.zero) { 02462 wp.gp[wx+n] = xp.gp[xx+n]; 02463 } 02464 } 02465 } 02466 } 02467 xp.free(); 02468 } 02469 } 02470 02471 pp.free(); 02472 return wp; 02473 }
MSGraph<T> jbxl::Density_Mask | ( | MSGraph< T > | vp, | |
double | rate, | |||
int | mode = 8 , |
|||
int | work_color = 0 | |||
) | [inline] |
template <typename t>=""> MSGraph<T> Density_Mask(MSGraph<T> vp, double rate, int mode=8, int work_color=0)
密度マスク
区画の中で縁に接して,かつ zeroでない画素の数を数え,全体の画素の 数に対して rate 以上の比率の場合,その画素パターンを返す.
rateに満たない場合は zero で埋められたパターンを返す.
vp | 画像データ | |
rate | 密度 | |
mode | モード. 8:8近傍の塗りつぶし. その他:4近傍の塗りつぶし | |
work_color | 作業用輝度値 |
Definition at line 2351 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::clear(), MSGraph< T >::color, MSGraph< T >::free(), MSGraph< T >::get_minmax(), MSGraph< T >::gp, MSGraph< T >::max, MSGraph< T >::mimicry(), MSGraph_Paint(), OFF, ON, MSGraph< T >::RZxy, MSGraph< T >::set(), set_around_MSGraph(), MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zero.
02352 { 02353 MSGraph<T> pp; 02354 int ps = vp.xs*vp.ys; 02355 02356 if (work_color==0) { 02357 if (vp.max==0 || vp.max==vp.zero) vp.get_minmax(); 02358 work_color = vp.max + 1; 02359 } 02360 pp.mimicry(vp); 02361 02362 if ((int)(ps*rate+0.5)==ps) { 02363 int eflg = OFF; 02364 for (int i=0; i<ps; i++) { 02365 if (vp.gp[i]==vp.zero) { 02366 pp.state = 0; 02367 eflg = ON; 02368 break; 02369 } 02370 } 02371 if (eflg==OFF) { 02372 for (int i=0; i<ps; i++) pp.gp[i] = vp.gp[i]; 02373 pp.state = ps; 02374 } 02375 return pp; 02376 } 02377 02378 MSGraph<T> xp; 02379 xp.set(vp.xs+2, vp.ys+2, 1, vp.zero, vp.base, vp.RZxy); 02380 xp.color = vp.color; 02381 02382 for (int j=0; j<vp.ys; j++) { 02383 for (int i=0; i<vp.xs; i++) { 02384 xp.gp[(j+1)*xp.xs+i+1] = vp.gp[j*vp.xs+i]; 02385 } 02386 } 02387 set_around_MSGraph(xp, xp.zero+1); 02388 MSGraph_Paint(xp, 0, 0, xp.zero+1, work_color-1, work_color, mode); 02389 02390 int nn = 0; 02391 for (int j=0; j<vp.ys; j++) { 02392 for (int i=0; i<vp.xs; i++) { 02393 if (xp.gp[(j+1)*xp.xs+i+1]==work_color) { 02394 pp.gp[j*pp.xs+i] = vp.gp[j*vp.xs+i]; 02395 nn++; 02396 } 02397 } 02398 } 02399 pp.state = nn; 02400 02401 if ((int)(ps*rate+0.5)>nn) { 02402 pp.state = 0; 02403 pp.clear(); 02404 } 02405 02406 xp.free(); 02407 return pp; 02408 }
DllExport void DestroyWing | ( | BREP_WING * | wing | ) |
void jbxl::DestroyWing(BREP_WING* wing)
Definition at line 910 of file Brep.cpp.
References BREP_EDGE::complete, BREP_WING::contour, BREP_CONTOUR::DisconnectWing(), BREP_VERTEX::DisconnectWing(), BREP_WING::edge, BREP_WING::vertex, BREP_EDGE::wing1, and BREP_EDGE::wing2.
Referenced by BREP_CONTOUR::DestroyWings().
00911 { 00912 wing->vertex->DisconnectWing(wing); 00913 wing->contour->DisconnectWing(wing); 00914 00915 if (!wing->edge->wing1->contour && !wing->edge->wing2->contour) { 00916 delete wing->edge; 00917 } 00918 else { 00919 wing->edge->complete = false; 00920 } 00921 }
Vector<double> jbxl::dgree_circle_MSGraph | ( | MSGraph< T > | vp | ) | [inline] |
template <typename t>=""> Vector<double> dgree_circle_MSGraph(MSGraph<T> vp)
2D画像において,vp.zero以外の輝度値のオブジェクトの分散度(円形度の逆数)を計算する.
穴空きのオブジェクトも計算可能.独自アルゴリズム.
vp | 画像データ |
Definition at line 90 of file Graph.h.
References count_area_MSGraph(), count_around_MSGraph(), PI, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
00091 { 00092 Vector<double> vt; 00093 double fac = 1.113757; 00094 // double fac = 1.182; 00095 00096 /* 00097 MSGraph<T> pp; 00098 pp.set(vp.xs+2, vp.ys+2, 1); 00099 for (int j=0; j<vp.ys; j++) { 00100 for (int i=0; i<vp.xs; i++) { 00101 pp.gp[(j+1)*pp.xs+i+1] = vp.gp[j*vp.xs+i]; 00102 } 00103 } 00104 */ 00105 vt.z = -1.0; 00106 vt.x = count_around_MSGraph(vp); 00107 vt.y = count_area_MSGraph(vp); 00108 if (vt.y!=0) vt.z = (vt.x*vt.x)/(4.*PI*vt.y)/fac; 00109 00110 //pp.free(); 00111 00112 return vt; 00113 }
int dicomHeader | ( | FILE * | fp, | |
int | fsize, | |||
int * | dsize, | |||
int * | xsize, | |||
int * | ysize, | |||
int * | depth, | |||
double * | rzxy | |||
) |
int jbxl::dicomHeader(FILE* fp, int fsize, int* dsize, int* xsize, int* ysize, int* depth, double* rzxy)
DICOM型式のファイルからヘッダを読みだす.
fp | DICOM型式ファイルへのファイル識別子 | |
fsize | ファイルのサイズ. | |
[out] | dsize | グラフィックデータの大きさが格納される. |
[out] | xsize | グラフィックデータの Xサイズが格納される. |
[out] | ysize | グラフィックデータの Yサイズが格納される. |
[out] | depth | グラフィックデータのデプス(Bit)が格納される. |
[out] | rzxy | Z軸の歪.0.0 なら不明. |
>0 | 読みこんだヘッダの大きさ (Byte単位). | |
0 | ヘッダの区切りを識別できなかった. | |
JBXL_GRAPH_INVARG_ERROR | 不正な引数 (fp, fsize, dsize) | |
JBXL_GRAPH_MEMORY_ERROR | メモリ不足 |
Definition at line 431 of file Gio.cpp.
References DICOM_DEPTH_ELEMENT, DICOM_IMAGE_GROUP, DICOM_INT_VR, DICOM_PIXCEL_VR, DICOM_PIXEL_ELEMENT, DICOM_PIXEL_GROUP, DICOM_PXLSPC_ELEMENT, DICOM_STR_VR, DICOM_XSIZE_ELEMENT, DICOM_YSIZE_ELEMENT, JBXL_GRAPH_IVDARG_ERROR, JBXL_GRAPH_MEMORY_ERROR, LNAME, OFF, and ON.
Referenced by readDicomData(), and readXHead().
00432 { 00433 int i, j, sz, rp, ef; 00434 int ln, hsize; 00435 int xs = 0, ys = 0, dp = 0; 00436 double rz = 0.0; 00437 00438 #ifdef WIN32 00439 uWord cn[2]; 00440 #else 00441 uWord cn[2] __attribute__((may_alias)); 00442 #endif 00443 uWord dt; 00444 uWord* wp; 00445 00446 if (fp==NULL || fsize<=0 || dsize==NULL) return JBXL_GRAPH_IVDARG_ERROR; 00447 00448 *dsize = 0; 00449 if (rzxy!=NULL) *rzxy = 0.0; 00450 ef = OFF; 00451 fseek(fp, 0, 0); 00452 00454 // ヘッダの区切りを検出 00455 rp = (int)fread(&dt, sizeof(uWord), 1, fp); 00456 while(!feof(fp) && ef!=ON) { 00457 //if ((uWord)ntohs(dt)==0xe07f) { 00458 if (dt==DICOM_PIXEL_GROUP) { 00459 rp += (int)fread(&dt, sizeof(uWord), 1, fp); 00460 //if ((uWord)ntohs(dt)==0x1000) { 00461 if (dt==DICOM_PIXEL_ELEMENT) { 00462 rp += (int)fread(&cn, sizeof(uWord), 2, fp); 00463 //if ((uWord)ntohs(cn[0])==0x4f57 && cn[1]==0x0000) { 00464 if (cn[0]==DICOM_PIXCEL_VR && cn[1]==0x0000) { 00465 rp += (int)fread(&cn, sizeof(uWord), 2, fp); 00466 } 00467 //*dsize = *((int*)cn); 00468 int* sizep = (int*)cn; 00469 *dsize = *sizep; 00470 hsize = rp*sizeof(uWord); 00471 if (fsize>=*dsize+hsize) { // footer 00472 ef = ON; 00473 break; 00474 } 00475 } 00476 } 00477 rp += (int)fread(&dt, sizeof(uWord), 1, fp); 00478 } 00479 00480 if (!ef) return 0; 00481 00482 sz = rp*sizeof(uWord); 00483 wp = (uWord*)malloc(sz); 00484 if (wp==NULL) return JBXL_GRAPH_MEMORY_ERROR; 00485 00487 // ヘッダ読み込み 00488 fseek(fp, 0, 0); 00489 fread(wp, sz, 1, fp); 00490 00491 for (i=0; i<sz/2-3; i++) { 00492 //if ((uWord)ntohs(wp[i])==0x2800 && (uWord)ntohs(wp[i+1])==0x3000) { 00493 if (wp[i]==DICOM_IMAGE_GROUP) { 00494 00495 // Z方向の歪 00496 if (wp[i+1]==DICOM_PXLSPC_ELEMENT) { 00497 char rx[LNAME], ry[LNAME]; 00498 uByte* bp; 00499 00500 memset(rx, 0, LNAME); 00501 memset(ry, 0, LNAME); 00502 00503 if (wp[i+2]==DICOM_STR_VR) ln = wp[i+3]; 00504 else ln = *(int*)&wp[i+2]; 00505 00506 if (ln<LNAME-1) { 00507 bp = (uByte*)&wp[i+4]; 00508 j = 0; 00509 while (j<ln-1 && bp[j]!='\\') { 00510 rx[j] = bp[j]; 00511 j++; 00512 } 00513 ln -= j + 1; 00514 bp += j + 1; 00515 j = 0; 00516 while (j<ln-1 && bp[j]!=' ') { 00517 ry[j] = bp[j]; 00518 j++; 00519 } 00520 if (!strcmp(rx, ry)) { 00521 rz = atof(rx); 00522 } 00523 } 00524 } 00525 00526 // X サイズ 00527 else if (wp[i+1]==DICOM_XSIZE_ELEMENT) { 00528 if (wp[i+2]==DICOM_INT_VR) ln = wp[i+3]; 00529 else ln = *(int*)&wp[i+2]; 00530 if (ln==2) { 00531 xs = (int)*(sWord*)&wp[i+4]; 00532 } 00533 else if (ln==4) { 00534 xs = *(int*)&wp[i+4]; 00535 } 00536 } 00537 00538 // Y サイズ 00539 else if (wp[i+1]==DICOM_YSIZE_ELEMENT) { 00540 if (wp[i+2]==DICOM_INT_VR) ln = wp[i+3]; 00541 else ln = *(int*)&wp[i+2]; 00542 if (ln==2) { 00543 ys = (int)*(sWord*)&wp[i+4]; 00544 } 00545 else if (ln==4) { 00546 ys = *(int*)&wp[i+4]; 00547 } 00548 } 00549 00550 // Depth 00551 else if (wp[i+1]==DICOM_DEPTH_ELEMENT) { 00552 if (wp[i+2]==DICOM_INT_VR) ln = wp[i+3]; 00553 else ln = *(int*)&wp[i+2]; 00554 if (ln==2) { 00555 dp = (int)*(sWord*)&wp[i+4]; 00556 } 00557 else if (ln==4) { 00558 dp = *(int*)&wp[i+4]; 00559 } 00560 } 00561 } 00562 } 00563 free(wp); 00564 00565 if (rzxy!=NULL) *rzxy = rz; 00566 if (xsize!=NULL) *xsize = xs; 00567 if (ysize!=NULL) *ysize = ys; 00568 if (depth!=NULL) *depth = dp; 00569 00570 return sz; 00571 }
bool jbxl::disJunctBounds | ( | RBound< T > | b1, | |
RBound< T > | b2 | |||
) | [inline] |
template <typename t>=""> inline bool disJunctBounds(RBound<T> b1, RBound<T> b2)
境界領域b1とb2が重なっているかどうかをチェック
true | 重なっていない | |
false | 重なっている |
Definition at line 576 of file Vector.h.
References RBound< T >::xmax, RBound< T >::xmin, RBound< T >::ymax, RBound< T >::ymin, RBound< T >::zmax, and RBound< T >::zmin.
Referenced by IsCollisionContours().
00577 { 00578 return (b1.xmin >= b2.xmax) || (b2.xmin >= b1.xmax) || 00579 (b1.ymin >= b2.ymax) || (b2.ymin >= b1.ymax) || 00580 (b1.zmin >= b2.zmax) || (b2.zmin >= b1.zmax); 00581 }
void DisPatcher | ( | int | signalno = 0 , |
|
... | ||||
) |
Windows用 ディスパッチャー
void WinDisPatcher(int sno=0, unsigned int signal1, unsigned int signal2, ...);
機能:シグナル(メッセージ)キューに溜まったシグナル(メッセージ)をディスパッチする. 引数に,無視する(ディスパッチしない)シグナル(メッセージ)を複数(可変)個指定可能. プログラム自体を終了させるシグナル(メッセージ)がキューにあった場合は,プログラムを 強制終了させる.Windowsの場合は WM_QUIT (0x0111)
Windows 用のみ実装.Linux の処理の仕方は知らない.......(不勉強です)
引数:無視するシグナル(メッセージ)の数,無視するシグナル1,無視するシグナル2,......... シグナル(メッセージ)自体は unsigned int で指定する. 無視するシグナル(メッセージ)を指定しない場合は,引数無しで呼び出し可能
例 :DisPatcher(1, WM_NCLBUTTONDOWN); DisPatcher(); DisPatcher(0) と同じ
Definition at line 41 of file tools++.cpp.
00042 { 00043 int i; 00044 unsigned int* ign_signal = NULL; 00045 00046 va_list args; 00047 va_start(args, signalno); 00048 00049 if (signalno>0) ign_signal = (unsigned int*)malloc(signalno*sizeof(int)); 00050 if (ign_signal==NULL) signalno = 0; 00051 for (i=0; i<signalno; i++) { 00052 ign_signal[i] = va_arg(args, unsigned int); 00053 } 00054 00055 MSG msg; 00056 while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)){ 00057 TranslateMessage(&msg); 00058 if (msg.message==WM_QUIT) exit(1); // 強制終了 00059 for (i=0; i<signalno; i++) { 00060 if (msg.message==ign_signal[i]) { 00061 msg.message = WM_NULL; 00062 break; 00063 } 00064 } 00065 DispatchMessage(&msg); 00066 } 00067 00068 free(ign_signal); 00069 va_end(args); 00070 return; 00071 }
Matrix<T> jbxl::dup_Matrix | ( | Matrix< T > | a | ) | [inline] |
template <typename t>=""> Matrix<T> dup_Matrix(Matrix<T> a)
同じ Matrixデータを作り出す.ただしメモリ部は共有しない
Definition at line 261 of file Matrix++.h.
References Matrix< T >::d, Matrix< T >::err, Matrix< T >::getm(), Matrix< T >::mx, Matrix< T >::n, Matrix< T >::r, and Matrix< T >::sz.
Referenced by Matrix< double >::dup().
00262 { 00263 Matrix<T> mtx; 00264 00265 if (a.sz!=NULL) { 00266 mtx.getm(a.n, a.sz); 00267 if (a.mx!=NULL && mtx.r==a.r) { 00268 for (int i=0; i<a.r; i++) { 00269 mtx.mx[i] = a.mx[i]; 00270 } 00271 } 00272 } 00273 00274 mtx.d = a.d; 00275 mtx.err = (T)(1); 00276 // 00277 return mtx; 00278 }
MSGraph<T>* jbxl::dup_MSGraph | ( | MSGraph< T > * | src | ) | [inline] |
template <typename t>=""> MSGraph<T>* dup_MSGraph(MSGraph<T>* src)
MSGraph<T>型データのコピーを作成する.
src | コピー元グラフィックデータ |
Definition at line 651 of file Graph.h.
References MSGraph< T >::getm(), MSGraph< T >::gp, MSGraph< T >::init(), MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, JBXL_GRAPH_NODATA_ERROR, MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00652 { 00653 if (src==NULL) return NULL; 00654 MSGraph<T>* vp = new MSGraph<T>(); 00655 00656 vp->init(); 00657 if (src->isNull()) { 00658 vp->state = JBXL_GRAPH_NODATA_ERROR; 00659 return vp; 00660 } 00661 00662 *vp = *src; 00663 vp->getm(src->xs, src->ys, src->zs, src->zero); 00664 if (vp->gp==NULL) { 00665 vp->init(); 00666 vp->state = JBXL_GRAPH_MEMORY_ERROR; 00667 return vp; 00668 } 00669 00670 for (int i=0; i<vp->xs*vp->ys*vp->zs; i++) vp->gp[i] = src->gp[i]; 00671 00672 return vp; 00673 }
MSGraph<T> jbxl::dup_MSGraph | ( | MSGraph< T > | src | ) | [inline] |
template <typename t>=""> MSGraph<T> dup_MSGraph(MSGraph<R> src)
MSGraph<T>型データのコピーを作成する.
src | コピー元グラフィックデータ |
Definition at line 618 of file Graph.h.
References MSGraph< T >::getm(), MSGraph< T >::gp, MSGraph< T >::init(), MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, JBXL_GRAPH_NODATA_ERROR, MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00619 { 00620 MSGraph<T> vp; 00621 00622 vp.init(); 00623 if (src.isNull()) { 00624 vp.state = JBXL_GRAPH_NODATA_ERROR; 00625 return vp; 00626 } 00627 00628 vp = src; 00629 vp.getm(src.xs, src.ys, src.zs, src.zero); 00630 if (vp.gp==NULL) { 00631 vp.init(); 00632 vp.state = JBXL_GRAPH_MEMORY_ERROR; 00633 return vp; 00634 } 00635 00636 for (int i=0; i<vp.xs*vp.ys*vp.zs; i++) vp.gp[i] = src.gp[i]; 00637 00638 return vp; 00639 }
DllExport int DupEdgeNumber | ( | BREP_CONTOUR * | contour | ) |
int jbxl::DupEdgeNumber(BREP_CONTOUR* contour)
Contourの多重Edgeの数を数える.
Definition at line 668 of file TriBrep.cpp.
References BREP_CONTOUR::dup_edge, BREP_WING::edge, BREP_EDGE::edge_list, BREP_WING::next, and BREP_CONTOUR::wing.
Referenced by CreateSurplusContoursList(), PatchupContour(), and ReverseContours().
00669 { 00670 contour->dup_edge = 0; 00671 00672 BREP_WING* first = contour->wing; 00673 if (first!=NULL) { 00674 BREP_WING* next = first; 00675 do { 00676 BREP_WING* wing = next; 00677 next = wing->next; 00678 if (wing->edge->edge_list!=NULL) contour->dup_edge++; 00679 } while(next!=first); 00680 } 00681 return contour->dup_edge; 00682 }
TriPolyData * dupTriPolyData | ( | TriPolyData * | data, | |
int | num | |||
) |
Definition at line 235 of file FacetBaseData.cpp.
00236 { 00237 if (data==NULL) return NULL; 00238 00239 TriPolyData* dup = (TriPolyData*)malloc(num*sizeof(TriPolyData)); 00240 if (dup==NULL) return NULL; 00241 00242 for (int i=0; i<num; i++) dup[i].dup(data[i]); 00243 return dup; 00244 }
Vector<T>* jbxl::dupVector | ( | Vector< T > * | a, | |
int | n | |||
) | [inline] |
MSGraph<R> jbxl::edgeEnhance | ( | MSGraph< T > | gd, | |
int | mode = 0 | |||
) | [inline] |
template <typename R, typename T> MSGraph<R> edgeEnhance(MSGraph<T> gd, int mode=0)
グラフィックデータのラプラシアンを使ったエッジ強調.(2Dのみ)
gd | 計算対象となるグラフィックデータ構造体. | |
mode | モード.4: 4近傍ラプラシアン 8: 8近傍ラプラシアン 3x3 その他: Sobelのラプラシアン(24近傍) 5x5 |
Definition at line 774 of file Gmt.h.
References DEBUG_MODE, MSGraph< T >::free(), MSGraph< T >::gp, MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, MSGraph< T >::mimicry(), PRINT_MESG, MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
00775 { 00776 int i; 00777 MSGraph<R> la, vp; 00778 00779 vp.mimicry(gd); 00780 if (vp.isNull()) { 00781 DEBUG_MODE PRINT_MESG("edgeEnhance: No More Memory!!\n"); 00782 vp.state = JBXL_GRAPH_MEMORY_ERROR; 00783 return vp; 00784 } 00785 00786 la = Laplacian<R>(gd, mode); 00787 for (i=0; i<vp.xs*vp.ys*vp.zs; i++) { 00788 vp.gp[i] = gd.gp[i] - la.gp[i]; 00789 } 00790 la.free(); 00791 00792 return vp; 00793 }
MSGraph<int> jbxl::euclidDistance | ( | MSGraph< T > | vp, | |
int | bc, | |||
int & | rr | |||
) | [inline] |
template <typename t>=""> MSGraph<int> euclidDistance(MSGraph<T> vp, int bc, int& rr)
WSGグラフィック上を 2値化し,各点における輝度値0の点からの ユークリッド距離の 2乗の最小を求める.
vp | 操作対象となるグラフィックデータ構造体. | |
bc | 輝度値の 2値化の値.これより小さいものは0,これ以上は 1. | |
rr | 指定しない.画像中のユークリッド距離の 2乗の最大値が入る. |
Definition at line 869 of file Gmt.h.
References MSGraph< T >::base, MSGraph< T >::clear(), DEBUG_MODE, MSGraph< T >::free(), MSGraph< T >::gp, MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, Max, Min, PRINT_MESG, MSGraph< T >::RZxy, MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
Referenced by centerLine().
00870 { 00871 int i, j, k, l, df, d, w; 00872 int rmax, rstart, rend; 00873 int nx, ny, nz, pl; 00874 00875 rr = -1; 00876 MSGraph<int> pp(vp.xs, vp.ys, vp.zs, (int)vp.zero, (int)vp.base, vp.RZxy); 00877 if (pp.isNull()) { 00878 DEBUG_MODE PRINT_MESG("euclidDistance: No More Memory!! E1\n"); 00879 pp.state = JBXL_GRAPH_MEMORY_ERROR; 00880 return pp; 00881 } 00882 00883 for (i=0; i<vp.xs*vp.ys*vp.zs; i++) { 00884 if (vp.gp[i]>=bc) pp.gp[i] = 1; 00885 else pp.gp[i] = 0; 00886 } 00887 00888 pl = vp.xs*vp.ys; 00889 00890 for (k=0; k<vp.zs; k++) { 00891 nz = k*pl; 00892 for (j=0; j<vp.ys; j++) { 00893 df = vp.xs; 00894 ny = nz + j*vp.xs; 00895 for (i=0; i<vp.xs; i++) { 00896 nx = ny + i; 00897 if (pp.gp[nx]!=0) df = df + 1; 00898 else df = 0; 00899 pp.gp[nx] = df*df; 00900 } 00901 } 00902 } 00903 00904 for (k=0; k<vp.zs; k++) { 00905 nz = k*pl; 00906 for (j=0; j<vp.ys; j++) { 00907 df = vp.xs; 00908 ny = nz + j*vp.xs; 00909 for (i=vp.xs-1; i>=0; i--) { 00910 nx = ny + i; 00911 if (pp.gp[nx]!=0) df = df + 1; 00912 else df = 0; 00913 pp.gp[nx] = Min(pp.gp[nx], df*df); 00914 } 00915 } 00916 } 00917 00918 rmax = Max(vp.ys, vp.zs); 00919 MSGraph<int> buf(rmax); 00920 if (buf.isNull()) { 00921 pp.free(); 00922 DEBUG_MODE PRINT_MESG("euclidDistance: No More Memory!! E2\n"); 00923 pp.state = JBXL_GRAPH_MEMORY_ERROR; 00924 return pp; 00925 } 00926 00927 for (k=0; k<vp.zs; k++) { 00928 nz = k*pl; 00929 for (i=0; i<vp.xs; i++) { 00930 nx = nz + i; 00931 for (j=0; j<vp.ys; j++) buf.gp[j] = pp.gp[nx+j*vp.xs]; 00932 for (j=0; j<vp.ys; j++) { 00933 ny = nx + j*vp.xs; 00934 d = buf.gp[j]; 00935 if (d!=0) { 00936 rmax = (int)sqrt((double)d) + 1; 00937 rstart = Min(rmax, j); 00938 rend = Min(rmax, vp.ys-j-1); 00939 for (l=-rstart; l<=rend; l++) { 00940 w = buf.gp[j+l] + l*l; 00941 if (w<d) d = w; 00942 } 00943 } 00944 pp.gp[ny] = d; 00945 } 00946 } 00947 } 00948 buf.clear(); 00949 00950 rr = 0; 00951 for (j=0; j<vp.ys; j++) { 00952 ny = j*vp.xs; 00953 for (i=0; i<vp.xs; i++) { 00954 nx = ny + i; 00955 for (k=0; k<vp.zs; k++) buf.gp[k] = pp.gp[nx+k*pl]; 00956 for (k=0; k<vp.zs; k++) { 00957 nz = nx + k*pl; 00958 d = buf.gp[k]; 00959 if (d!=0) { 00960 rmax = (int)sqrt((double)d) + 1; 00961 rstart = Min(rmax, k); 00962 rend = Min(rmax, vp.zs-k-1); 00963 for (l=-rstart; l<=rend; l++) { 00964 w = buf.gp[k+l] + l*l; 00965 if (w<d) d = w; 00966 } 00967 rr = Max(rr, d); 00968 } 00969 pp.gp[nz] = d; 00970 } 00971 } 00972 } 00973 buf.free(); 00974 00975 return pp; 00976 }
Quaternion<T> jbxl::ExtEulerXYZ2Quaternion | ( | Vector< T > | e | ) | [inline] |
Definition at line 238 of file Rotation.h.
References Quaternion< T >::setExtEulerXYZ().
Matrix<T> jbxl::ExtEulerXYZ2RotMatrix | ( | Vector< T > | eul | ) | [inline] |
Definition at line 659 of file Rotation.h.
References Matrix< T >::element(), Vector< T >::element1(), Vector< T >::element2(), and Vector< T >::element3().
00660 { 00661 Matrix<T> mtx(2, 3, 3); 00662 00663 T sinx = (T)sin(eul.element1()); 00664 T cosx = (T)cos(eul.element1()); 00665 T siny = (T)sin(eul.element2()); 00666 T cosy = (T)cos(eul.element2()); 00667 T sinz = (T)sin(eul.element3()); 00668 T cosz = (T)cos(eul.element3()); 00669 00670 mtx.element(1, 1) = cosy*cosz; 00671 mtx.element(1, 2) = sinx*siny*cosz - cosx*sinz; 00672 mtx.element(1, 3) = cosx*siny*cosz + sinx*sinz; 00673 mtx.element(2, 1) = cosy*sinz; 00674 mtx.element(2, 2) = sinx*siny*sinz + cosx*cosz; 00675 mtx.element(2, 3) = cosx*siny*sinz - sinx*cosz; 00676 mtx.element(3, 1) = -siny; 00677 mtx.element(3, 2) = sinx*cosy; 00678 mtx.element(3, 3) = cosx*cosy; 00679 00680 return mtx; 00681 }
Quaternion<T> jbxl::ExtEulerXZY2Quaternion | ( | Vector< T > | e | ) | [inline] |
Definition at line 240 of file Rotation.h.
References Quaternion< T >::setExtEulerXZY().
Matrix<T> jbxl::ExtEulerXZY2RotMatrix | ( | Vector< T > | eul | ) | [inline] |
Definition at line 711 of file Rotation.h.
References Matrix< T >::element(), Vector< T >::element1(), Vector< T >::element2(), and Vector< T >::element3().
00712 { 00713 Matrix<T> mtx(2, 3, 3); 00714 00715 T sinx = (T)sin(eul.element1()); 00716 T cosx = (T)cos(eul.element1()); 00717 T sinz = (T)sin(eul.element2()); 00718 T cosz = (T)cos(eul.element2()); 00719 T siny = (T)sin(eul.element3()); 00720 T cosy = (T)cos(eul.element3()); 00721 00722 mtx.element(1, 1) = cosy*cosz; 00723 mtx.element(1, 2) = -cosx*cosy*sinz + sinx*siny; 00724 mtx.element(1, 3) = sinx*cosy*sinz + cosx*siny; 00725 mtx.element(2, 1) = sinz; 00726 mtx.element(2, 2) = cosx*cosz; 00727 mtx.element(2, 3) = -sinx*cosz; 00728 mtx.element(3, 1) = -siny*cosz; 00729 mtx.element(3, 2) = cosx*siny*sinz + sinx*cosy; 00730 mtx.element(3, 3) = -sinx*siny*sinz + cosx*cosy; 00731 00732 return mtx; 00733 }
Quaternion<T> jbxl::ExtEulerYXZ2Quaternion | ( | Vector< T > | e | ) | [inline] |
Definition at line 242 of file Rotation.h.
References Quaternion< T >::setExtEulerYXZ().
Matrix<T> jbxl::ExtEulerYXZ2RotMatrix | ( | Vector< T > | eul | ) | [inline] |
Definition at line 789 of file Rotation.h.
References Matrix< T >::element(), Vector< T >::element1(), Vector< T >::element2(), and Vector< T >::element3().
00790 { 00791 Matrix<T> mtx(2, 3, 3); 00792 00793 T siny = (T)sin(eul.element1()); 00794 T cosy = (T)cos(eul.element1()); 00795 T sinx = (T)sin(eul.element2()); 00796 T cosx = (T)cos(eul.element2()); 00797 T sinz = (T)sin(eul.element3()); 00798 T cosz = (T)cos(eul.element3()); 00799 00800 mtx.element(1, 1) = -sinx*siny*sinz + cosy*cosz; 00801 mtx.element(1, 2) = -cosx*sinz; 00802 mtx.element(1, 3) = sinx*cosy*sinz + siny*cosz; 00803 mtx.element(2, 1) = sinx*siny*cosz + cosy*sinz; 00804 mtx.element(2, 2) = cosx*cosz; 00805 mtx.element(2, 3) = -sinx*cosy*cosz + siny*sinz; 00806 mtx.element(3, 1) = -cosx*siny; 00807 mtx.element(3, 2) = sinx; 00808 mtx.element(3, 3) = cosx*cosy; 00809 00810 return mtx; 00811 }
Quaternion<T> jbxl::ExtEulerYZX2Quaternion | ( | Vector< T > | e | ) | [inline] |
Definition at line 241 of file Rotation.h.
References Quaternion< T >::setExtEulerYZX().
Matrix<T> jbxl::ExtEulerYZX2RotMatrix | ( | Vector< T > | eul | ) | [inline] |
Definition at line 737 of file Rotation.h.
References Matrix< T >::element(), Vector< T >::element1(), Vector< T >::element2(), and Vector< T >::element3().
00738 { 00739 Matrix<T> mtx(2, 3, 3); 00740 00741 T siny = (T)sin(eul.element1()); 00742 T cosy = (T)cos(eul.element1()); 00743 T sinz = (T)sin(eul.element2()); 00744 T cosz = (T)cos(eul.element2()); 00745 T sinx = (T)sin(eul.element3()); 00746 T cosx = (T)cos(eul.element3()); 00747 00748 mtx.element(1, 1) = cosy*cosz; 00749 mtx.element(1, 2) = -sinz; 00750 mtx.element(1, 3) = siny*cosz; 00751 mtx.element(2, 1) = cosx*cosy*sinz + sinx*siny; 00752 mtx.element(2, 2) = cosx*cosz; 00753 mtx.element(2, 3) = cosx*siny*sinz - sinx*cosy; 00754 mtx.element(3, 1) = sinx*cosy*sinz - cosx*siny; 00755 mtx.element(3, 2) = sinx*cosz; 00756 mtx.element(3, 3) = sinx*siny*sinz + cosx*cosy; 00757 00758 return mtx; 00759 }
Quaternion<T> jbxl::ExtEulerZXY2Quaternion | ( | Vector< T > | e | ) | [inline] |
Definition at line 243 of file Rotation.h.
References Quaternion< T >::setExtEulerZXY().
Matrix<T> jbxl::ExtEulerZXY2RotMatrix | ( | Vector< T > | eul | ) | [inline] |
Definition at line 763 of file Rotation.h.
References Matrix< T >::element(), Vector< T >::element1(), Vector< T >::element2(), and Vector< T >::element3().
00764 { 00765 Matrix<T> mtx(2, 3, 3); 00766 00767 T sinz = (T)sin(eul.element1()); 00768 T cosz = (T)cos(eul.element1()); 00769 T sinx = (T)sin(eul.element2()); 00770 T cosx = (T)cos(eul.element2()); 00771 T siny = (T)sin(eul.element3()); 00772 T cosy = (T)cos(eul.element3()); 00773 00774 mtx.element(1, 1) = sinx*siny*sinz + cosy*cosz; 00775 mtx.element(1, 2) = sinx*siny*cosz - cosy*sinz; 00776 mtx.element(1, 3) = cosx*siny; 00777 mtx.element(2, 1) = cosx*sinz; 00778 mtx.element(2, 2) = cosx*cosz; 00779 mtx.element(2, 3) = -sinx; 00780 mtx.element(3, 1) = sinx*cosy*sinz - siny*cosz; 00781 mtx.element(3, 2) = sinx*cosy*cosz + siny*sinz; 00782 mtx.element(3, 3) = cosx*cosy; 00783 00784 return mtx; 00785 }
Quaternion<T> jbxl::ExtEulerZYX2Quaternion | ( | Vector< T > | e | ) | [inline] |
Definition at line 239 of file Rotation.h.
References Quaternion< T >::setExtEulerZYX().
Matrix<T> jbxl::ExtEulerZYX2RotMatrix | ( | Vector< T > | eul | ) | [inline] |
Definition at line 685 of file Rotation.h.
References Matrix< T >::element(), Vector< T >::element1(), Vector< T >::element2(), and Vector< T >::element3().
00686 { 00687 Matrix<T> mtx(2, 3, 3); 00688 00689 T sinz = (T)sin(eul.element1()); 00690 T cosz = (T)cos(eul.element1()); 00691 T siny = (T)sin(eul.element2()); 00692 T cosy = (T)cos(eul.element2()); 00693 T sinx = (T)sin(eul.element3()); 00694 T cosx = (T)cos(eul.element3()); 00695 00696 mtx.element(1, 1) = cosy*cosz; 00697 mtx.element(1, 2) = -cosy*sinz; 00698 mtx.element(1, 3) = siny; 00699 mtx.element(2, 1) = sinx*siny*cosz + cosx*sinz; 00700 mtx.element(2, 2) = -sinx*siny*sinz + cosx*cosz; 00701 mtx.element(2, 3) = -sinx*cosy; 00702 mtx.element(3, 1) = -cosx*siny*cosz + sinx*sinz; 00703 mtx.element(3, 2) = cosx*siny*sinz + sinx*cosz; 00704 mtx.element(3, 3) = cosx*cosy; 00705 00706 return mtx; 00707 }
DllExport void FastDeleteFacet | ( | BREP_FACET * | facet | ) |
void jbxl::FastDeleteFacet(BREP_FACET* facet)
直前に生成した Facetを高速に削除する.
直前に生成したものでない Facetを指定した場合は誤作動する.
Facetの数が多い場合,delete(Facet) または ~BREP_FACET()を実行すると一々find()を呼び出すので時間が掛かる.
Definition at line 804 of file TriBrep.cpp.
References BREP_CONTOUR::facet, BREP_SHELL::facets, BREP_FACET::outer_contours, and BREP_FACET::shell.
Referenced by PatchupContour(), and ReverseContours().
00805 { 00806 if (facet==NULL) return; 00807 if (facet->shell!=NULL) { 00808 facet->shell->facets.pop_back(); 00809 facet->shell = NULL; 00810 } 00811 00812 // Destroy its contours 00813 BREP_CONTOUR* bpcn; 00814 BREP_CONTOUR_LIST::iterator contour = facet->outer_contours.begin(); 00815 00816 while (contour!=facet->outer_contours.end()) { 00817 bpcn = *contour; 00818 contour = facet->outer_contours.erase(contour); 00819 bpcn->facet = NULL; 00820 delete (bpcn); 00821 } 00822 free(facet); 00823 00824 return; 00825 }
MSGraph<T> jbxl::fat_object_morph | ( | MSGraph< T > | vp, | |
MSGraph< T > | xp, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> MSGraph<T> fat_object_morph(MSGraph<T> vp, MSGraph<T> xp, int cc)
画像を太らせる処理(何て言うんだっけ?)
Definition at line 177 of file Morph.h.
References copy_morph_element(), MSGraph< T >::gp, MSGraph< T >::isNull(), point_fat_object_morph(), MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
00178 { 00179 int i, j, k, ps, cz, cy, cx; 00180 bool err; 00181 MSGraph<T> wp(vp.xs, vp.ys, vp.zs); 00182 if (wp.isNull()) return wp; 00183 00184 ps = vp.xs*vp.ys; 00185 for (k=0; k<vp.zs; k++) { 00186 cz = k*ps; 00187 for (j=0; j<vp.ys; j++) { 00188 cy = cz + j*vp.xs; 00189 for (i=0; i<vp.xs; i++) { 00190 cx = cy + i; 00191 if (vp.gp[cx]>=cc) { 00192 err = point_fat_object_morph(vp, i, j, k, xp, cc); 00193 if (err) copy_morph_element(wp, i, j, k, xp); 00194 } 00195 } 00196 } 00197 } 00198 00199 return wp; 00200 }
DllExport void FillShortageWings | ( | BREP_SOLID * | solid, | |
int | method, | |||
bool | mode | |||
) |
void jbxl::FillShortageWings(BREP_SOLID* solid, int method, bool mode)
足りないContourを補充する(全ての不足Contourが無くなるか,補充不可能になるまで).
Contours List, Wings List, SohrtageWins Listの内容は保障される.
solid | ソリッドデータへのポインタ | |
method | 1: 三番目のVertexを探すアルゴリズムは Next. | |
method | 2: 三番目のVertexを探すアルゴリズムは Near. | |
mode | true : 多重Edgeを認める. | |
mode | false: 多重Edgeを認めない. |
Definition at line 301 of file TriBrep.cpp.
References BREP_SOLID::counter, CreateShortageWingsList(), FillShortageWings_Near(), FillShortageWings_Next(), CVCounter::GetUsableCounter(), JBXL_BREP_MAX_LOOPCNT, CVCounter::SetMax(), and BREP_SOLID::shortage_wings.
00302 { 00303 if (solid->shortage_wings.empty()) return; 00304 // DEBUG_MODE PRINT_MESG("Start FillShortageWings\n"); 00305 00306 int wmax = (int)solid->shortage_wings.size(); 00307 CVCounter* counter = NULL; 00308 if (solid->counter!=NULL) counter = solid->counter->GetUsableCounter(); 00309 if (counter!=NULL) counter->SetMax(wmax); 00310 00311 int lpc = 0; 00312 int pno = 1; 00313 while (solid->shortage_wings.size()>1 && pno!=0 && lpc<JBXL_BREP_MAX_LOOPCNT) { 00314 if (method==1) pno = FillShortageWings_Next(solid, mode); 00315 else if (method==2) pno = FillShortageWings_Near(solid, mode); 00316 else { 00317 // DEBUG_MODE PRINT_MESG("FillShortageWings: 知らない手法が指定された %d\n", method); 00318 // DEBUG_MODE PRINT_MESG("End FillShortageWings\n"); 00319 return; 00320 } 00321 CreateShortageWingsList(solid); 00322 //DEBUG_MODE PRINT_MESG("FillShortageWings: 不完全Wingデータは %d/%d 個 %d\n", solid->shortage_wings.size(), wmax, pno); 00323 lpc++; 00324 } 00325 00326 // DEBUG_MODE PRINT_MESG("End FillShortageWings\n"); 00327 return; 00328 }
DllExport int FillShortageWings_Near | ( | BREP_SOLID * | solid, | |
bool | mode | |||
) |
DllExport int jbxl::FillShortageWings_Near(BREP_SOLID* solid, bool mode)
足りないContourを補充する(一周期のみ).Nearアルゴリズム
Edgeの中心から近いVertexを探して三角形(Contour)を作る.
Contours List と Wings Listの内容は保障される.
solid | ソリッドデータへのポインタ | |
mode | true : 多重Edgeを認める. | |
mode | false: 多重Edgeを認めない. |
Definition at line 394 of file TriBrep.cpp.
References BREP_WING::contour, CreateContoursList(), CreateWingsList(), BREP_VERTEX::distance2, BREP_CONTOUR::facet, GetWingOtherSide(), IsIncludeCompleteEdge(), JBXL_BREP_MAX_QUEUESIZE, Vector< T >::norm2(), PatchupContour(), BREP_VERTEX::point, SetMinVertex(), BREP_FACET::shell, BREP_SOLID::shortage_wings, and BREP_WING::vertex.
Referenced by FillShortageWings().
00395 { 00396 int patchno = 0; 00397 BREP_VERTEX_LIST vertex_list; 00398 00399 BREP_WING_LIST::iterator wing1; 00400 for (wing1=solid->shortage_wings.begin(); wing1!=solid->shortage_wings.end(); wing1++){ 00401 if (!IsIncludeCompleteEdge(*wing1)) { 00402 BREP_VERTEX* vert[3]; 00403 vert[0] = (*wing1)->vertex; 00404 vert[1] = GetWingOtherSide(*wing1)->vertex; 00405 vert[2] = NULL; 00406 vertex_list.clear(); 00407 00408 BREP_WING_LIST::iterator wing2; 00409 for (wing2=solid->shortage_wings.begin(); wing2!=solid->shortage_wings.end(); wing2++){ 00410 if (wing1!=wing2) { 00411 BREP_VERTEX* vrtx = (*wing2)->vertex; 00412 if (vrtx!=vert[0] && vrtx!=vert[1]) { 00413 /* int cnt = 0; 00414 BREP_VERTEX* v = vert[1]; 00415 do { 00416 v = FindConnectEdgeVertex(v); 00417 cnt++; 00418 } while (v!=vert[0] && v!=vert[1] && v!=vrtx && v!=NULL && cnt<100); 00419 */ 00420 // if (v!=vrtx) { 00421 Vector<double> vect = (*wing1)->edge->center - vrtx->point; 00422 vrtx->distance2 = vect.norm2(); 00423 SetMinVertex(&vertex_list, vrtx); 00424 // } 00425 } 00426 } 00427 } 00428 00429 int cnt=0; 00430 BREP_SHELL* shell = GetWingOtherSide(*wing1)->contour->facet->shell; 00431 BREP_VERTEX_LIST::iterator ivert; 00432 for (ivert=vertex_list.begin(); ivert!=vertex_list.end(); ivert++){ 00433 vert[2] = *ivert; 00434 if (PatchupContour(shell, vert, mode)) { 00435 patchno++; 00436 break; 00437 } 00438 cnt++; 00439 if (cnt>=JBXL_BREP_MAX_QUEUESIZE) break; 00440 } 00441 00442 } 00443 } 00444 CreateContoursList(solid); 00445 CreateWingsList(solid); 00446 00447 return patchno; 00448 }
DllExport int FillShortageWings_Next | ( | BREP_SOLID * | solid, | |
bool | mode | |||
) |
int jbxl::FillShortageWings_Next(BREP_SOLID* solid, bool mode)
足りないContourを補充する(一周期のみ).Nextアルゴリズム
Edgeに繋がっているEdgeを探してそのVertexから三角形(Contour)を作る.
Contours List と Wings Listの内容は保障される.
solid | ソリッドデータへのポインタ | |
mode | true : 多重Edgeを認める. | |
mode | false: 多重Edgeを認めない. |
Definition at line 347 of file TriBrep.cpp.
References BREP_WING::contour, CreateContoursList(), CreateWingsList(), BREP_CONTOUR::facet, GetWingOtherSide(), IsConnectEdges(), IsIncludeCompleteEdge(), PatchupContour(), BREP_FACET::shell, BREP_SOLID::shortage_wings, and BREP_WING::vertex.
Referenced by FillShortageWings().
00348 { 00349 int patchno = 0; 00350 00351 BREP_WING_LIST::iterator wing1; 00352 for (wing1=solid->shortage_wings.begin(); wing1!=solid->shortage_wings.end(); wing1++){ 00353 if (!IsIncludeCompleteEdge(*wing1)) { 00354 BREP_VERTEX* vert[3]; 00355 00356 vert[0] = (*wing1)->vertex; 00357 BREP_WING_LIST::iterator wing2; 00358 for (wing2=solid->shortage_wings.begin(); wing2!=solid->shortage_wings.end(); wing2++){ 00359 if (!IsIncludeCompleteEdge(*wing2) && IsConnectEdges(*wing1, *wing2)) { 00360 vert[1] = (*wing2)->vertex; 00361 vert[2] = GetWingOtherSide(*wing2)->vertex; // vert[]: Contourを貼る頂点 00362 BREP_SHELL* shell = GetWingOtherSide(*wing1)->contour->facet->shell; 00363 if (PatchupContour(shell, vert, mode)) patchno++; 00364 } 00365 } 00366 } 00367 } 00368 CreateContoursList(solid); 00369 CreateWingsList(solid); 00370 00371 return patchno; 00372 }
DllExport BREP_VERTEX * FindConnectEdgeVertex | ( | BREP_VERTEX * | vert | ) |
BREP_VERTEX* jbxl::FindConnectEdgeVertex(BREP_VERTEX* vert)
vertexと Edgeで繋がった vertexの内,最初に見つけたものを返す.
Definition at line 478 of file TriBrep.cpp.
References GetWingOtherSide(), BREP_WING::vertex, and BREP_VERTEX::wing_list.
00479 { 00480 BREP_WING_LIST::iterator iwing; 00481 for (iwing=vert->wing_list.begin(); iwing!=vert->wing_list.end(); iwing++){ 00482 if ((*iwing)->contour==NULL) { 00483 return GetWingOtherSide(*iwing)->vertex; 00484 } 00485 } 00486 return NULL; 00487 }
DllExport BREP_EDGE * FindEdge | ( | BREP_VERTEX * | vertex1, | |
BREP_VERTEX * | vertex2 | |||
) |
BREP_EDGE* jbxl::FindEdge(BREP_VERTEX* vertex1, BREP_VERTEX* vertex2)
vertex1と vertex2が既にエッジで結ばれているかどうかをチェックする.
もし結ばれていれば,最初に見つけた Edgeを返す.
vertex1--Wing1--Edge--Wing2--vertex2
Definition at line 935 of file Brep.cpp.
References BREP_WING::edge, GetWingOtherSide(), BREP_WING::vertex, and BREP_VERTEX::wing_list.
Referenced by CreateWingWithoutContour(), and IsForbiddenEdge().
00936 { 00937 BREP_WING_LIST list; 00938 BREP_WING_LIST::iterator iwing; 00939 00940 list = vertex2->wing_list; 00941 for (iwing=list.begin(); iwing!=list.end(); iwing++){ 00942 BREP_WING* wing = *iwing; 00943 if (GetWingOtherSide(wing)->vertex==vertex1) return wing->edge; 00944 } 00945 00946 list = vertex1->wing_list; 00947 for (iwing=list.begin(); iwing!=list.end(); iwing++) { 00948 BREP_WING* wing = *iwing; 00949 if (GetWingOtherSide(wing)->vertex==vertex2) return wing->edge; 00950 } 00951 00952 return NULL; 00953 }
void free_CmnHead | ( | CmnHead * | hd | ) |
void jbxl::free_CmnHead(CmnHead* hd)
共通ヘッダのメモリ領域を開放する.cmnHead.kind は HEADER_ERRになる
initCmnHead()を内包している.
hd | 開放する共通ヘッダ |
Definition at line 26 of file Gdata.cpp.
References CmnHead::buf, CmnHead::grptr, and init_CmnHead().
Referenced by copyMSGraph2CmnHead(), ExCmnHead::ffree(), ExCmnHead::free(), ExCmnHead::mfree(), readCmnHeadFile(), readGraphicFile(), readGraphicSlices(), readUserSetData(), readXHead(), and readXHeadFile().
00027 { 00028 if (hd!=NULL) { 00029 if (hd->buf!=NULL) free(hd->buf); 00030 if (hd->grptr!=NULL) free(hd->grptr); 00031 init_CmnHead(hd); 00032 } 00033 }
void jbxl::freeAffineTrans | ( | AffineTrans< T > *& | affine | ) | [inline] |
Definition at line 374 of file Rotation.h.
References AffineTrans< T >::free().
Referenced by MeshObjectData::delAffineTrans().
00375 { 00376 if (affine!=NULL){ 00377 affine->free(); 00378 delete(affine); 00379 affine = NULL; 00380 } 00381 }
void jbxl::freeBrepSolid | ( | BREP_SOLID *& | solid | ) | [inline] |
Definition at line 107 of file Brep.h.
References BREP_SOLID::FreeData().
Referenced by MeshObjectNode::computeVertexByBREP(), and BrepSolidList::free().
void jbxl::freeBrepSolidList | ( | BrepSolidList *& | solids | ) | [inline] |
Definition at line 53 of file BrepLib.h.
References BrepSolidList::free().
void jbxl::freeColladaXML | ( | ColladaXML *& | xml | ) | [inline] |
Definition at line 126 of file ColladaTool.h.
References ColladaXML::free().
void jbxl::freeFacetBaseData | ( | FacetBaseData *& | facet | ) | [inline] |
Definition at line 131 of file FacetBaseData.h.
References FacetBaseData::free().
void jbxl::freeMeshObjectData | ( | MeshObjectData *& | data | ) | [inline] |
Definition at line 160 of file MeshObjectData.h.
References MeshObjectData::free().
Referenced by MeshObjectData::joinData().
void freeMeshObjectList | ( | MeshObjectNode *& | node | ) |
Definition at line 379 of file MeshObjectData.cpp.
References freeMeshObjectNode(), and MeshObjectNode::next.
Referenced by MeshObjectData::free().
00380 { 00381 if (node==NULL) return; 00382 00383 MeshObjectNode* next = node->next; 00384 if (next!=NULL) freeMeshObjectList(next); 00385 00386 freeMeshObjectNode(node); 00387 00388 return; 00389 }
void jbxl::freeMeshObjectNode | ( | MeshObjectNode *& | node | ) | [inline] |
Definition at line 90 of file MeshObjectData.h.
References MeshObjectNode::free().
Referenced by DelMeshObjectNode(), and freeMeshObjectList().
void jbxl::freeNull | ( | T & | p | ) | [inline] |
Definition at line 44 of file common++.h.
References isNull().
Referenced by ColladaXML::addGeometry(), MeshObjectData::addNode(), FacetBaseData::free(), MeshObjectData::free_value(), MeshObjectNode::free_value(), MeshObjectData::importTriData(), readGraphicSlices(), readMoonData(), readRasData(), and readUserSetData().
00044 { if (!jbxl::isNull(p)) ::free(p); p = (T)NULL;}
DllExport void freeSTL | ( | STLData * | stldata | ) |
void freeTriPolyData | ( | TriPolyData *& | tridata, | |
int | n | |||
) |
Definition at line 276 of file FacetBaseData.cpp.
References TriPolyData::free().
00277 { 00278 if (tridata!=NULL) { 00279 for (int i=0; i<n; i++) { 00280 tridata[i].free(); 00281 } 00282 ::free(tridata); 00283 tridata = NULL; 00284 } 00285 }
void jbxl::freeTriPolyData | ( | TriPolyData *& | tridata | ) | [inline] |
Definition at line 168 of file FacetBaseData.h.
References TriPolyData::free().
Referenced by joinTriPolyData().
RBound<int> jbxl::get_boundary_MSGraph | ( | MSGraph< T > | vp, | |
T | mn, | |||
T | mx | |||
) | [inline] |
template <typename t>=""> RBound<int> get_boundary_MSGraph(MSGraph<T> vp, T mn, T mx)
3Dオブジェクト境界を得る.
Definition at line 397 of file Graph.h.
References RBound< T >::cutdown(), RBound< T >::fusion(), MSGraph< T >::gp, MSGraph< T >::rbound, RBound< T >::set(), MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
00398 { 00399 int nx, ny, nz, ps; 00400 RBound<int> rb; 00401 00402 rb.set(vp.xs, 0, vp.ys, 0, vp.zs, 0); 00403 00404 ps = vp.xs*vp.ys; 00405 for (int k=0; k<vp.zs; k++) { 00406 nz = k*ps; 00407 for (int j=0; j<vp.ys; j++) { 00408 ny = j*vp.xs + nz; 00409 for (int i=0; i<vp.xs; i++) { 00410 nx = i + ny; 00411 if (vp.gp[nx]>=mn && vp.gp[nx]<=mx) { 00412 rb.fusion((T)i, (T)j, (T)k); 00413 } 00414 } 00415 } 00416 } 00417 00418 rb.cutdown(vp.rbound); 00419 00420 return rb; 00421 }
CmnHead jbxl::getinfo_CmnHead(CmnHead hd)
ヘッダ情報のみをコピーする.
Definition at line 59 of file Gdata.cpp.
References CmnHead::bsize, CmnHead::buf, and CmnHead::grptr.
Referenced by readGraphicSlices().
00060 { 00061 CmnHead cmnhd = hd; 00062 00063 cmnhd.bsize = 0; 00064 cmnhd.buf = NULL; 00065 cmnhd.grptr = NULL; 00066 00067 return cmnhd; 00068 }
MSGraph<T>* jbxl::getMSGraphFromCvMat | ( | cv::Mat | mat | ) | [inline] |
template <typename t>=""> MSGraph<T>* getMSGraphFromCvMat(cv::Mat mat)
MSGraph<T> から OpenCV用の Matデータを作り出す.
T を cv::Mat の型と合わせるのは,呼び出し側の責任. cv::Matの型と(長さなどが)合わない型Tを指定した場合,戻り値のデータ内容は保障されない.
Mat のチャンネル数は 1と 3のみをサポート. 浮動小数点の depth(CV_32F, CV_64F)は変換できない.
T は uByte, sByte, uWord, sWord または unsigned int を指定する.
mat | 元のMatデータ |
cv::Mat src_img = cv::imread("suba.ras"); MSGraph<uByte>* zp = getMSGraphFromCvMat<uByte>(src_img); // <uWord> にすると精度が落ちる xp = new MSGraph<sWord>(); copy_MSGraph(*zp, *xp); delete(zp); または cv::Mat gray, src_img = cv::imread("suba.ras"); cv::cvtColor(src_img, gray, CV_BGR2GRAY); xp = getMSGraphFromCvMat<sWord>(gray);
Definition at line 215 of file OpenCVTool.h.
00216 { 00217 MSGraph<T>* vp = NULL; 00218 00219 if (mat.channels()==1) { 00220 if (mat.depth()==CV_8U) vp = _getMSGraph_CvMat_C1<T, uByte>(mat); 00221 else if (mat.depth()==CV_8S) vp = _getMSGraph_CvMat_C1<T, sByte>(mat); 00222 else if (mat.depth()==CV_16U) vp = _getMSGraph_CvMat_C1<T, uWord>(mat); 00223 else if (mat.depth()==CV_16S) vp = _getMSGraph_CvMat_C1<T, sWord>(mat); 00224 else if (mat.depth()==CV_32S) vp = _getMSGraph_CvMat_C1<T, int>(mat); 00225 //else if (mat.depth()==CV_32F) vp = _getMSGraph_CvMat_C1<T, double>(mat); 00226 //else if (mat.depth()==CV_64F) vp = _getMSGraph_CvMat_C1<T, double>(mat); 00227 } 00228 00229 else if (mat.channels()==3) { 00230 if (mat.depth()==CV_8U) vp = _getMSGraph_CvMat_C3<T, uByte>(mat); 00231 else if (mat.depth()==CV_8S) vp = _getMSGraph_CvMat_C3<T, sByte>(mat); 00232 else if (mat.depth()==CV_16U) vp = _getMSGraph_CvMat_C3<T, uWord>(mat); 00233 else if (mat.depth()==CV_16S) vp = _getMSGraph_CvMat_C3<T, sWord>(mat); 00234 else if (mat.depth()==CV_32S) vp = _getMSGraph_CvMat_C3<T, int>(mat); 00235 //else if (mat.depth()==CV_32F) vp = getMSGraph_CvMatC3<T, double>(mat); 00236 //else if (mat.depth()==CV_64F) vp = getMSGraph_CvMatC3<T, double>(mat); 00237 } 00238 00239 return vp; 00240 }
DllExport BREP_VERTEX ** GetOctreeVertices | ( | OctreeNode * | octree, | |
long int * | vertexno | |||
) |
要free
Definition at line 960 of file Brep.cpp.
References OctreeGetter().
Referenced by BrepSolidList::addSolid(), and MeshObjectNode::computeVertexByBREP().
00961 { 00962 BREP_VERTEX** vindex = NULL; 00963 00964 long int num = OctreeGetter(octree, NULL, 0); 00965 00966 if (num>0) { 00967 vindex = (BREP_VERTEX**)malloc(num*sizeof(BREP_VERTEX*)); 00968 } 00969 if (vindex!=NULL) { 00970 OctreeGetter(octree, vindex, 0); 00971 } 00972 if (vertexno!=NULL) *vertexno = num; 00973 00974 return vindex; 00975 }
CVCounter* jbxl::GetUsableGlobalCounter | ( | ) | [inline] |
Definition at line 185 of file ClassBox.h.
References CVCounter::GetUsableCounter(), and GLCounter.
Referenced by copyCmnHead2MSGraph(), copyMSGraph2CmnHead(), cut_object_MSGraph(), readCmnHeadFile(), readGraphicFile(), readGraphicSlices(), readUserSetData(), readXHeadFile(), writeCmnHeadData(), writeGraphicFile(), x_reverse_MSGraph(), xSobel(), xxSobel(), ySobel(), yySobel(), zSobel(), and zzSobel().
00186 { 00187 if (GLCounter!=NULL) return GLCounter->GetUsableCounter(); 00188 else return NULL; 00189 }
BREP_WING* jbxl::GetWingOtherSide(BREP_WING* wing)
Edgeに関連付けられたもう一方の Wing を返す.
Definition at line 1079 of file Brep.cpp.
References BREP_WING::edge, BREP_EDGE::wing1, and BREP_EDGE::wing2.
Referenced by BREP_CONTOUR::CreateWing(), CreateWingsList(), DeleteShortageWings(), DeleteStraightEdges(), FillShortageWings_Near(), FillShortageWings_Next(), FindConnectEdgeVertex(), FindEdge(), IsConnectEdges(), and JoinShortageWings().
01080 { 01081 if (wing==wing->edge->wing1) return wing->edge->wing2; 01082 // 01083 return wing->edge->wing1; 01084 }
MSGraph<T>* jbxl::grab_MSGraph | ( | MSGraph< T > * | vp, | |
int | x1, | |||
int | y1, | |||
int | x2, | |||
int | y2, | |||
int | zs = 0 , |
|||
int | ze = 0 | |||
) | [inline] |
template <typename t>=""> MSGraph<T>* grab_MSGraph(MSGraph<T>* vp, int x1, int y1, int x2, int y2, int zs=0, int ze=0)
MSGraph<T>型データvpの (x1,y1)-(x2,y2)の矩形部分だけを取り出す.
(x1,y1)-(x2,y2)が元のデータの範囲を越える場合は,元のデータに合わせられる.
輝度値の最大(max),最小(min) も設定される.
vp | 操作対象グラフィックデータ | |
(x1,y1),(x2,y2) | 矩形の対角の座標. | |
zs,ze | z軸の範囲 |
Definition at line 2184 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::color, MSGraph< T >::init(), MSGraph< T >::max, Max, MSGraph< T >::min, Min, MSGraph< T >::point(), MSGraph< T >::rbound, MSGraph< T >::set(), RBound< T >::xmax, RBound< T >::xmin, MSGraph< T >::xs, RBound< T >::ymax, RBound< T >::ymin, MSGraph< T >::ys, MSGraph< T >::zero, RBound< T >::zmax, RBound< T >::zmin, and MSGraph< T >::zs.
02185 { 02186 int i, j, k; 02187 int xs, xe, ys, ye; 02188 int xsize, ysize, zsize; 02189 MSGraph<T>* xp = new MSGraph<T>(); 02190 02191 xp->init(); 02192 xs = Min(x1, x2); 02193 xe = Max(x1, x2); 02194 xs = Max(xs, 0); 02195 xe = Min(xe, vp->xs-1); 02196 ys = Min(y1, y2); 02197 ye = Max(y1, y2); 02198 ys = Max(ys, 0); 02199 ye = Min(ye, vp->ys-1); 02200 zs = Max(zs, 0); 02201 ze = Min(ze, vp->zs-1); 02202 02203 xsize = xe - xs + 1; 02204 ysize = ye - ys + 1; 02205 zsize = ze - zs + 1; 02206 02207 xp->set(xsize, ysize, zsize, vp->zero, vp->base); 02208 xp->color = vp->color; 02209 02210 xp->max = vp->point(xs, ys, zs); 02211 xp->min = xp->max; 02212 02213 for (k=0; k<zsize; k++) { 02214 for (j=0; j<ysize; j++) { 02215 for (i=0; i<xsize; i++) { 02216 T point = vp->point(xs+i, ys+j, zs+k); 02217 xp->point(i, j, k) = point; 02218 if (point>xp->max) xp->max = point; 02219 else if (point<xp->min) xp->min = point; 02220 } 02221 } 02222 } 02223 02224 xp->rbound.xmin = vp->rbound.xmin + xs; 02225 xp->rbound.xmax = vp->rbound.xmin + xe; 02226 xp->rbound.ymin = vp->rbound.ymin + ys; 02227 xp->rbound.ymax = vp->rbound.ymin + ye; 02228 xp->rbound.zmin = vp->rbound.zmin + zs; 02229 xp->rbound.zmax = vp->rbound.zmin + ze; 02230 return xp; 02231 }
MSGraph<T> jbxl::grab_MSGraph | ( | MSGraph< T > | vp, | |
int | x1, | |||
int | y1, | |||
int | x2, | |||
int | y2, | |||
int | zs = 0 , |
|||
int | ze = 0 | |||
) | [inline] |
template <typename t>=""> MSGraph<T> grab_MSGraph(MSGraph<T> vp, int x1, int y1, int x2, int y2, int zs=0, int ze=0)
MSGraph<T>型データvpの (x1,y1)-(x2,y2)の矩形部分だけを取り出す.
(x1,y1)-(x2,y2)が元のデータの範囲を越える場合は,元のデータに合わせられる.
vp | 操作対象グラフィックデータ | |
(x1,y1),(x2,y2) | 矩形の対角の座標. | |
zs,ze | z軸の範囲 |
Definition at line 2119 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::color, MSGraph< T >::init(), MSGraph< T >::isNull(), MSGraph< T >::max, Max, MSGraph< T >::min, Min, MSGraph< T >::point(), MSGraph< T >::rbound, MSGraph< T >::set(), RBound< T >::xmax, RBound< T >::xmin, MSGraph< T >::xs, RBound< T >::ymax, RBound< T >::ymin, MSGraph< T >::ys, MSGraph< T >::zero, RBound< T >::zmax, RBound< T >::zmin, and MSGraph< T >::zs.
02120 { 02121 int i, j, k; 02122 int xs, xe, ys, ye; 02123 int xsize, ysize, zsize; 02124 MSGraph<T> xp; 02125 02126 xp.init(); 02127 xs = Min(x1, x2); 02128 xe = Max(x1, x2); 02129 xs = Max(xs, 0); 02130 xe = Min(xe, vp.xs-1); 02131 ys = Min(y1, y2); 02132 ye = Max(y1, y2); 02133 ys = Max(ys, 0); 02134 ye = Min(ye, vp.ys-1); 02135 zs = Max(zs, 0); 02136 ze = Min(ze, vp.zs-1); 02137 02138 xsize = xe - xs + 1; 02139 ysize = ye - ys + 1; 02140 zsize = ze - zs + 1; 02141 02142 xp.set(xsize, ysize, zsize, vp.zero, vp.base); 02143 if (xp.isNull()) return xp; 02144 xp.color = vp.color; 02145 02146 xp.max = vp.point(xs, ys, zs); 02147 xp.min = xp.max; 02148 02149 for (k=0; k<zsize; k++) { 02150 for (j=0; j<ysize; j++) { 02151 for (i=0; i<xsize; i++) { 02152 T point = vp.point(xs+i, ys+j, zs+k); 02153 xp.point(i, j, k) = point; 02154 if (point>xp.max) xp.max = point; 02155 else if (point<xp.min) xp.min = point; 02156 } 02157 } 02158 } 02159 02160 xp.rbound.xmin = vp.rbound.xmin + xs; 02161 xp.rbound.xmax = vp.rbound.xmin + xe; 02162 xp.rbound.ymin = vp.rbound.ymin + ys; 02163 xp.rbound.ymax = vp.rbound.ymin + ye; 02164 xp.rbound.zmin = vp.rbound.zmin + zs; 02165 xp.rbound.zmax = vp.rbound.zmin + ze; 02166 return xp; 02167 }
void init_CmnHead | ( | CmnHead * | hd | ) |
void jbxl::init_CmnHead(CmnHead* hd)
共通ヘッダのメモリ領域を初期化する.cmnHead.kind は HEADER_ERRになる
hd | 初期化する共通ヘッダ |
Definition at line 43 of file Gdata.cpp.
References CmnHead::bsize, CmnHead::buf, CmnHead::depth, CmnHead::grptr, HEADER_NONE, CmnHead::kind, CmnHead::lsize, CmnHead::xsize, CmnHead::ysize, and CmnHead::zsize.
Referenced by free_CmnHead(), ExCmnHead::getm(), ExCmnHead::init(), readUserSetData(), and ExCmnHead::set().
00044 { 00045 if (hd!=NULL) { 00046 hd->buf = hd->grptr = NULL; 00047 hd->kind = HEADER_NONE; 00048 hd->xsize = hd->ysize = hd->zsize = 0; 00049 hd->depth = hd->bsize = hd->lsize = 0; 00050 } 00051 }
DllExport int IsAtLine | ( | BREP_VERTEX ** | v | ) |
Definition at line 871 of file TriBrep.cpp.
References Max, ProportionVector(), Vertex2TVector(), and Zero_Eps.
Referenced by IsForbiddenEdge().
00872 { 00873 TVector<double> vect = Vertex2TVector(v[0]); 00874 TVector<double> vect1 = Vertex2TVector(v[1]); 00875 TVector<double> vect2 = Vertex2TVector(v[2]) - vect; 00876 TVector<double> vect3 = Vertex2TVector(v[2]) - vect1; 00877 vect1 = vect1 - vect; 00878 00879 int mode = 0; 00880 double tt; 00881 double th = ProportionVector(vect2, vect1, tt); 00882 tt = Max(tt, Zero_Eps); 00883 if (th>1.-tt) mode = 1; // 0->1->2 00884 else { 00885 th = ProportionVector(vect1, vect2, tt); 00886 tt = Max(tt, Zero_Eps); 00887 if (th>1.-tt) mode = 2; // 0->2->1 00888 else { 00889 th = ProportionVector(vect3, vect2, tt); 00890 tt = Max(tt, Zero_Eps); 00891 if (th>1.-tt) mode = 3; // 1->0->2 00892 } 00893 } 00894 return mode; 00895 }
DllExport bool IsCollisionContours | ( | BREP_SOLID * | solid, | |
BREP_CONTOUR * | contour, | |||
BREP_CONTOUR ** | collision | |||
) |
bool jbxl::IsCollisionContours(BREP_SOLID* solid, BREP_CONTOUR* contour, BREP_CONTOUR** collision)
Contour が他の Contourと衝突しているかどうかをチェックする.
Definition at line 950 of file TriBrep.cpp.
References CollisionTriContour2D(), CollisionTriContour3D(), CommonVertex(), BREP_CONTOUR::ComputeDirectRS(), BREP_SOLID::contours, disJunctBounds(), BREP_CONTOUR::facet, BREP_CONTOUR::hasCollisionVector, IsInTriangle(), BREP_FACET::rbound, and SamePlaneContour().
Referenced by PatchupContour().
00951 { 00952 *collision = NULL; 00953 00954 BREP_CONTOUR_LIST::iterator icon; 00955 for (icon=solid->contours.begin(); icon!=solid->contours.end(); icon++){ 00956 if (!disJunctBounds(contour->facet->rbound, (*icon)->facet->rbound)) { 00957 if (!(*icon)->facet->deletable || (*icon)->facet->notdelete) { 00958 int svrtx = CommonVertex(*icon, contour); 00959 if (svrtx==3) { 00960 *collision = *icon; 00961 return true; 00962 } 00963 00964 int lineno; 00965 if (SamePlaneContour(*icon, contour, lineno)) { 00966 // 3角形の内部点 00967 if (!contour->hasCollisionVector) contour->ComputeDirectRS(); 00968 if (IsInTriangle(*icon, contour)) { 00969 *collision = *icon; 00970 return true; 00971 } 00972 if (!(*icon)->hasCollisionVector) (*icon)->ComputeDirectRS(); 00973 if (IsInTriangle(contour, *icon)) { 00974 *collision = *icon; 00975 return true; 00976 } 00977 00978 // 2D衝突検査 00979 if (CollisionTriContour2D(*icon, contour)) { 00980 *collision = *icon; 00981 return true; 00982 } 00983 } 00984 else { 00985 if (lineno==1) continue; 00986 // 3D衝突検査 00987 if (!contour->hasCollisionVector) contour->ComputeDirectRS(); 00988 if (CollisionTriContour3D(*icon, contour)) { 00989 *collision = *icon; 00990 return true; 00991 } 00992 if (!(*icon)->hasCollisionVector) (*icon)->ComputeDirectRS(); 00993 if (CollisionTriContour3D(contour, *icon)) { 00994 *collision = *icon; 00995 return true; 00996 } 00997 } 00998 } 00999 } 01000 } 01001 return false; 01002 }
Definition at line 1515 of file TriBrep.cpp.
References GetWingOtherSide(), and BREP_WING::vertex.
Referenced by DeleteStraightEdges(), and FillShortageWings_Next().
01516 { 01517 if (GetWingOtherSide(wing1)->vertex==wing2->vertex) return true; 01518 return false; 01519 }
DllExport bool IsForbiddenEdge | ( | BREP_VERTEX ** | vert | ) |
bool jbxl::IsForbiddenEdge(BREP_VERTEX** vert)
Vertex vert[0]〜vert[2] が一直線に並んでいるか調べる.
一直線の場合は,該当Edgeを禁止する.また,既にその Edgeがある場合は関連 Contourを削除する.
Definition at line 905 of file TriBrep.cpp.
References FindEdge(), BREP_VERTEX::forbidden_list, IsAtLine(), and SetDeletableContoursByEdge().
Referenced by CreateContourByVector(), CreateContourByVertex(), and DeleteStraightEdges().
00906 { 00907 BREP_EDGE* edge = NULL; 00908 int mode = IsAtLine(vert); 00909 if (mode==1) { // 0->1->2 00910 if (vert[0]->forbidden_list==NULL) vert[0]->forbidden_list = new BREP_VERTEX_LIST(); 00911 if (vert[2]->forbidden_list==NULL) vert[2]->forbidden_list = new BREP_VERTEX_LIST(); 00912 vert[0]->forbidden_list->push_back(vert[2]); 00913 vert[2]->forbidden_list->push_back(vert[0]); 00914 edge = FindEdge(vert[0], vert[2]); 00915 } 00916 else if (mode==2) { // 0->2->1 00917 if (vert[0]->forbidden_list==NULL) vert[0]->forbidden_list = new BREP_VERTEX_LIST(); 00918 if (vert[1]->forbidden_list==NULL) vert[1]->forbidden_list = new BREP_VERTEX_LIST(); 00919 vert[0]->forbidden_list->push_back(vert[1]); 00920 vert[1]->forbidden_list->push_back(vert[0]); 00921 edge = FindEdge(vert[0], vert[1]); 00922 } 00923 else if (mode==3) { // 2->0->1 00924 if (vert[1]->forbidden_list==NULL) vert[1]->forbidden_list = new BREP_VERTEX_LIST(); 00925 if (vert[2]->forbidden_list==NULL) vert[2]->forbidden_list = new BREP_VERTEX_LIST(); 00926 vert[1]->forbidden_list->push_back(vert[2]); 00927 vert[2]->forbidden_list->push_back(vert[1]); 00928 edge = FindEdge(vert[1], vert[2]); 00929 } 00930 if (edge!=NULL) SetDeletableContoursByEdge(edge); 00931 00932 if (mode==0) return false; 00933 return true; 00934 }
DllExport bool IsIncludeCompleteEdge | ( | BREP_WING * | wing | ) |
bool jbxl::IsIncludeCompleteEdge(BREP_WING* wing)
Wingに関連したEdge及びその多重Edgeは完全か?
そこにあるEdgeの内,最低一つは閉じているか?
Definition at line 781 of file TriBrep.cpp.
References BREP_EDGE::complete, BREP_WING::edge, and BREP_EDGE::edge_list.
Referenced by FillShortageWings_Near(), and FillShortageWings_Next().
00782 { 00783 BREP_EDGE* edge = wing->edge; 00784 if (edge->complete) return true; 00785 if (edge->edge_list!=NULL) { 00786 BREP_EDGE_LIST::iterator iedge; 00787 for (iedge=edge->edge_list->begin(); iedge!=edge->edge_list->end(); iedge++){ 00788 if ((*iedge)->complete) return true; 00789 } 00790 } 00791 return false; 00792 }
DllExport bool IsInTriangle | ( | BREP_CONTOUR * | contour1, | |
BREP_CONTOUR * | contour2 | |||
) |
Definition at line 1155 of file TriBrep.cpp.
References Collision_Tolerance, BREP_CONTOUR::directR, BREP_CONTOUR::directRS, BREP_CONTOUR::directS, Max, Vector< T >::n, BREP_WING::next, ProportionVector(), TVector< T >::t, BREP_WING::vertex, Vertex2TVector(), and BREP_CONTOUR::wing.
Referenced by IsCollisionContours().
01156 { 01157 double tc, uc, tt, ut; 01158 TVector<double> directS = contour2->directS; 01159 TVector<double> directRS = contour2->directRS; 01160 TVector<double> directQ, directT, directN; 01161 BREP_WING* wing = contour1->wing; 01162 01163 for (int i=0; i<3; i++) { 01164 for (int j=0; j<2; j++) { 01165 directN = Vertex2TVector(wing->vertex); 01166 if (j==0) directQ = Vertex2TVector(contour2->wing->vertex) - directN; 01167 else directQ = directQ - (Vertex2TVector(wing->next->vertex) - directN)*0.5; 01168 01169 TVector<double> directSQ = directS^directQ; 01170 TVector<double> directQR = directQ^contour2->directR; 01171 tc = ProportionVector(directQR, directSQ, tt); 01172 uc = ProportionVector(directSQ, directRS, ut); 01173 directT = contour2->directR + tc*directS; 01174 ut = Max(ut, Collision_Tolerance); 01175 tt = Max(tt, Collision_Tolerance); 01176 if (tc>tt && 1.-tc>tt && uc>ut && 1.-uc>ut && 01177 tc*directS.n>directS.t && (1.-tc)*directS.n>directS.t && 01178 uc*directT.n>directT.t && (1.-uc)*directT.n>directT.t) { 01179 // DEBUG_MODE PRINT_MESG("三角形の内部 %d : %e %e %e %e\n", j+1, tc, uc, tt, ut); 01180 //PrintFacetAsciiSTL(contour1); 01181 //PrintFacetAsciiSTL(contour2); 01182 return true; 01183 } 01184 } 01185 } 01186 return false; 01187 }
bool jbxl::isNull | ( | void * | p | ) | [inline] |
Definition at line 32 of file common++.h.
Referenced by CRingBuffer::free(), and freeNull().
00032 { 00033 if (p==NULL) return true; 00034 00035 #ifdef WIN32 00036 if (p==WIN_DD_NULL) return true; 00037 #endif 00038 00039 return false; 00040 }
bool jbxl::isSameDimension | ( | const Matrix< T > | v1, | |
const Matrix< T > | v2 | |||
) | [inline] |
Definition at line 464 of file Matrix++.h.
References Matrix< T >::n, Matrix< T >::r, and Matrix< T >::sz.
Referenced by operator+(), operator-(), and operator==().
00465 { 00466 if (v1.n!=v2.n || v1.r!=v2.r) return false; 00467 for (int i=0; i<v1.n; i++) if (v1.sz[i]!=v2.sz[i]) return false; 00468 return true; 00469 }
bool isSameMaterial | ( | MaterialParam | a, | |
MaterialParam | b | |||
) |
マテリアルのパラメータを比べる.
Definition at line 404 of file MaterialParam.cpp.
References MaterialParam::bumpmap, MaterialParam::getBase64Params(), isSameTexture(), MaterialParam::specmap, and MaterialParam::texture.
Referenced by MeshObjectNode::setMaterialParam().
00405 { 00406 if (!isSameTexture(a.texture, b.texture)) return false; 00407 if (!isSameTexture(a.bumpmap, b.bumpmap)) return false; 00408 if (!isSameTexture(a.specmap, b.specmap)) return false; 00409 00410 // 00411 bool ret = true; 00412 00413 char* a_param = a.getBase64Params(); 00414 char* b_param = b.getBase64Params(); 00415 // 00416 if (a_param!=NULL && b_param!=NULL) { 00417 if (strcmp(a_param, b_param)) ret = false; 00418 } 00419 else if (a_param!=NULL || b_param!=NULL) { 00420 ret = false; 00421 } 00422 if (a_param!=NULL) ::free(a_param); 00423 if (b_param!=NULL) ::free(b_param); 00424 00425 return ret; 00426 }
bool isSameTexture | ( | TextureParam | a, | |
TextureParam | b | |||
) |
テクスチャ名,カラーを比べる
Definition at line 192 of file MaterialParam.cpp.
References TextureParam::getColor(), and TextureParam::getName().
Referenced by isSameMaterial().
00193 { 00194 char* a_name = a.getName(); 00195 char* b_name = b.getName(); 00196 if (a_name!=NULL && b_name!=NULL) { 00197 if (strcmp(a_name, b_name)) return false; 00198 } 00199 else if (a_name!=NULL || b_name!=NULL) return false; 00200 00201 // 00202 for (int i=0; i<4; i++) { 00203 if (a.getColor(i)!=b.getColor(i)) return false; 00204 } 00205 00206 return true; 00207 }
DllExport void JoinShortageWings | ( | BREP_SOLID * | solid | ) |
void jbxl::JoinShortageWings(BREP_SOLID* solid)
不完全かつ多重Edgeになっているが,実は一つのEdgeにまとめることができるものを一つにまとめる.
Contours List と Wings Listの内容は保障される.
Definition at line 608 of file TriBrep.cpp.
References BREP_EDGE::complete, BREP_WING::contour, CreateContoursList(), CreateWingsList(), BREP_WING::edge, BREP_EDGE::edge_list, GetWingOtherSide(), BREP_SOLID::shortage_wings, BREP_WING::vertex, BREP_EDGE::wing1, and BREP_EDGE::wing2.
Referenced by DeleteSurplusContours().
00609 { 00610 if (solid->shortage_wings.empty()) return; 00611 // DEBUG_MODE PRINT_MESG("Start JoinShortageWings\n"); 00612 00613 BREP_WING_LIST::iterator iwing; 00614 for (iwing=solid->shortage_wings.begin(); iwing!=solid->shortage_wings.end(); iwing++){ 00615 BREP_WING* wingA = (*iwing); 00616 00617 if (GetWingOtherSide(wingA)->contour==NULL) { // 両方NULL 00618 delete (wingA->edge); 00619 continue; 00620 } 00621 00622 if (wingA->edge->edge_list!=NULL) { 00623 BREP_EDGE_LIST* edge_list = wingA->edge->edge_list; 00624 BREP_EDGE_LIST::iterator iedge; 00625 for (iedge=edge_list->begin(); iedge!=edge_list->end(); iedge++){ 00626 if (wingA==(*iedge)->wing1 || wingA==(*iedge)->wing2) continue; 00627 if ((*iedge)->wing1->contour!=NULL && (*iedge)->wing2->contour!=NULL) continue; 00628 00629 BREP_WING* wingB; 00630 if ((*iedge)->wing1->contour!=NULL) wingB = (*iedge)->wing1; 00631 else if ((*iedge)->wing2->contour!=NULL) wingB = (*iedge)->wing2; 00632 else continue; // 両方NULLをこちらが先に見つけた.→ 上のdeleteコードに任せる. 00633 00634 if (wingA->vertex==wingB->vertex) { 00635 if (wingA->edge->wing1==wingA) wingA->edge->wing1 = wingB; 00636 else if (wingA->edge->wing2==wingA) wingA->edge->wing2 = wingB; 00637 if (wingB->edge->wing1==wingB) wingB->edge->wing1 = wingA; 00638 else if (wingB->edge->wing2==wingB) wingB->edge->wing2 = wingA; 00639 00640 BREP_EDGE* sedge = wingB->edge; 00641 wingB->edge = wingA->edge; 00642 wingA->edge = sedge; 00643 wingB->edge->complete = true; 00644 wingA->edge->complete = false; 00645 break; 00646 } 00647 } 00648 } 00649 } 00650 CreateContoursList(solid); 00651 CreateWingsList(solid); 00652 00653 // DEBUG_MODE PRINT_MESG("End JoinShortageWings\n"); 00654 return; 00655 }
TriPolyData * joinTriPolyData | ( | TriPolyData *& | first, | |
int | num_f, | |||
TriPolyData *& | next, | |||
int | num_n | |||
) |
Definition at line 248 of file FacetBaseData.cpp.
References TriPolyData::dup(), TriPolyData::facetNum, and freeTriPolyData().
00249 { 00250 if (first==NULL) return next; 00251 if (next ==NULL) return first; 00252 00253 TriPolyData* join = (TriPolyData*)malloc((num_f+num_n)*sizeof(TriPolyData)); 00254 if (join==NULL) return NULL; 00255 00256 int fnum = 0; 00257 for (int i=0; i<num_f; i++) { 00258 join[i].dup(first[i]); 00259 if (join[i].facetNum>fnum) fnum = join[i].facetNum; 00260 } 00261 fnum += 1; 00262 00263 for (int i=0; i<num_n; i++) { 00264 join[num_f+i].dup(next[i]); 00265 join[num_f+i].facetNum += fnum; 00266 } 00267 00268 freeTriPolyData(first, num_f); 00269 freeTriPolyData(next, num_n); 00270 00271 return join; 00272 }
MSGraph<R> jbxl::Laplacian | ( | MSGraph< T > | vp, | |
int | mode = 0 | |||
) | [inline] |
template <typename R, typename T> MSGraph<R> Laplacian(MSGraph<T> vp, int mode=0)
2Dグラフィックデータのラプラシアンを計算する.
vp | 計算対象となるグラフィックデータ構造体. | |
mode | モード.4: 4近傍ラプラシアン 8: 8近傍ラプラシアン その他: Sobelのラプラシアン(24近傍) |
Definition at line 61 of file Gmt.h.
References MSGraph< T >::base, DEBUG_MODE, MSGraph< T >::gp, MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, MSGraph< T >::mimicry(), PRINT_MESG, MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zero.
00062 { 00063 int i, j; 00064 int nx, ny, xs, xs2; 00065 R da, db, dc, dd, de, df, dg, dh; 00066 MSGraph<R> lp; 00067 00068 lp.mimicry(vp); 00069 lp.base = lp.zero = 0; 00070 00071 if (lp.isNull()) { 00072 DEBUG_MODE PRINT_MESG("LAPLACIAN: No More Memory!!!\n"); 00073 lp.state = JBXL_GRAPH_MEMORY_ERROR; 00074 return lp; 00075 } 00076 00077 xs = vp.xs; 00078 xs2 = 2*xs; 00079 00080 if (mode==4) { 00081 for (j=1; j<vp.ys-1; j++) { 00082 ny = j*vp.xs; 00083 for (i=1; i<vp.xs-1; i++) { 00084 nx = ny + i; 00085 da = vp.gp[nx+1] + vp.gp[nx-1]; 00086 db = vp.gp[nx]; 00087 dc = vp.gp[nx+xs] + vp.gp[nx-xs]; 00088 lp.gp[nx] = (R)(da - 4.*db + dc); 00089 //da = vp.point(i+1, j) + vp.point(i-1, j); 00090 //db = vp.point(i, j); 00091 //dc = vp.point(i, j+1) + vp.point(i, j-1); 00092 //lp.point(i, j) = (R)(da - 4.*db + dc); 00093 } 00094 } 00095 } 00096 00097 else if (mode==8) { 00098 for (j=1; j<vp.ys-1; j++) { 00099 ny = j*vp.xs; 00100 for (i=1; i<vp.xs-1; i++) { 00101 nx = ny + i; 00102 da = vp.gp[nx+1] + vp.gp[nx-1]; 00103 db = vp.gp[nx+xs] + vp.gp[nx-xs]; 00104 dc = vp.gp[nx]; 00105 dd = vp.gp[nx+1+xs] + vp.gp[nx-1+xs]; 00106 de = vp.gp[nx+1-xs] + vp.gp[nx-1-xs]; 00107 lp.gp[nx] = (R)(da + db - 8.*dc + dd + de); 00108 //da = vp.point(i+1, j) + vp.point(i-1, j); 00109 //db = vp.point(i, j+1) + vp.point(i, j-1); 00110 //dc = vp.point(i, j); 00111 //dd = vp.point(i+1, j+1) + vp.point(i-1, j+1); 00112 //de = vp.point(i+1, j-1) + vp.point(i-1, j-1); 00113 //lp.point(i, j) = (R)(da + db - 8.*dc + dd + de); 00114 } 00115 } 00116 } 00117 00118 else { 00119 for (j=2; j<vp.ys-2; j++) { 00120 ny = j*vp.xs; 00121 for (i=2; i<vp.xs-2; i++) { 00122 nx = ny + i; 00123 da = vp.gp[nx]; 00124 db = vp.gp[nx+1] + vp.gp[nx-1] + vp.gp[nx+xs] + vp.gp[nx-xs]; 00125 dc = vp.gp[nx-1-xs2] + vp.gp[nx-xs2] + vp.gp[nx+1-xs2]; 00126 dd = vp.gp[nx-1+xs2] + vp.gp[nx+xs2] + vp.gp[nx+1+xs2]; 00127 de = vp.gp[nx-2-xs ] + vp.gp[nx-2] + vp.gp[nx-2+xs]; 00128 df = vp.gp[nx+2-xs ] + vp.gp[nx+2] + vp.gp[nx+2+xs]; 00129 dg = vp.gp[nx-2-xs2] + vp.gp[nx+2-xs2]; 00130 dh = vp.gp[nx-2+xs2] + vp.gp[nx+2+xs2]; 00131 lp.gp[nx] = (R)((-12.*da - 4.*db + 2.*(dc+dd+de+df) + dg + dh)/32.); 00132 00133 //da = vp.point(i, j); 00134 //db = vp.point(i+1, j) + vp.point(i-1, j) + vp.point(i, j+1) + vp.point(i, j-1); 00135 //dc = vp.point(i-1, j-2) + vp.point(i, j-2) + vp.point(i+1, j-2); 00136 //dd = vp.point(i-1, j+2) + vp.point(i, j+2) + vp.point(i+1, j+2); 00137 //de = vp.point(i-2, j-1) + vp.point(i-2, j) + vp.point(i-2, j+1); 00138 //df = vp.point(i+2, j-1) + vp.point(i+2, j) + vp.point(i+2, j+1); 00139 //dg = vp.point(i-2, j-2) + vp.point(i+2, j-2); 00140 //dh = vp.point(i-2, j+2) + vp.point(i+2, j+2); 00141 //lp.point(i, j) = (R)((-12.*da - 4.*db + 2.*(dc+dd+de+df) + dg + dh)/32.); 00142 } 00143 } 00144 } 00145 00146 return lp; 00147 }
void jbxl::Local2World | ( | MSGraph< T > | gd, | |
MSGraph< T > | vp, | |||
Vector< R > | oq, | |||
Vector< R > | op, | |||
Vector< R > | ex, | |||
double * | pcsf = NULL , |
|||
double * | psnf = NULL | |||
) | [inline] |
template <typename T, typename R> void Local2World(MSGraph<T> gd, MSGraph<T> vp, Vector<R> oq, Vector<R> op, Vector<R> ex, double pcsf=0.0, double psnf=1.0)
ローカルな観測座標系のグラフィック vpをグローバル座標系のグラフィック gd に埋めこむ.
ローカルな観測座標系 → ローカルな極座標系 → グローバル座標系
変換先の点の周りの格子点全てに値を設定する.
gd | グローバル座標系のグラフィック空間. | |
vp | 観測座標系のグラフィックデータ(左上が原点). | |
oq | グローバル座標系から見たローカルな極座標系の原点の座標. | |
op | 観測座標系から見たローカルな極座標系の原点の座標. | |
ex | ローカルな極座標系から見た観測座標系のx軸(ローカルな極座標系でのz軸)の向き. | |
pcsf | sinθ≒0 の場合に *csfに代入される.連続計算の場合に直前の cosφの値を指定する. | |
psnf | sinθ≒0 の場合に *snfに代入される.連続計算の場合に直前の sinφの値を指定する. |
Definition at line 749 of file Graph.h.
References MSGraph< T >::gp, ON, MSGraph< T >::set_vPoint(), ToPola(), Vector< T >::x, MSGraph< T >::xs, Vector< T >::y, MSGraph< T >::ys, Vector< T >::z, MSGraph< T >::zero, and MSGraph< T >::zs.
Referenced by MSGraph_Circle3D(), MSGraph_Pool(), and MSGraph_Torus().
00750 { 00751 int x, y, z, cx, cy, cz; 00752 double px, py, pz, xx, yy, zz; 00753 double cst, snt, csf=0.0, snf=1.0; 00754 00755 if (pcsf!=NULL && psnf!=NULL) { 00756 csf = *pcsf; 00757 snf = *psnf; 00758 } 00759 00760 ToPola(ex, cst, snt, csf, snf, csf, snf); 00761 00762 for (z=0; z<vp.zs; z++) { 00763 cz = z*vp.xs*vp.ys; 00764 for (y=0; y<vp.ys; y++) { 00765 cy = cz + y*vp.xs; 00766 for (x=0; x<vp.xs; x++) { 00767 cx = cy + x; 00768 if (vp.gp[cx]!=vp.zero) { 00769 px = z - op.z; // ローカルな極座標系の原点へ 00770 py = op.x - x; 00771 pz = op.y - y; 00772 xx = px*snt*csf - py*snf - pz*cst*csf + oq.x; 00773 yy = px*snt*snf + py*csf - pz*cst*snf + oq.y; 00774 zz = px*cst + pz*snt + oq.z; 00775 gd.set_vPoint(xx, yy, zz, vp.gp[cx], ON); 00776 } 00777 } 00778 } 00779 } 00780 00781 if (pcsf!=NULL && psnf!=NULL) { 00782 *pcsf = csf; 00783 *psnf = snf; 00784 } 00785 }
MSGraph<T> jbxl::make_element_morph | ( | Parameter32 | x | ) | [inline] |
template <typename t>=""> MSGraph<T> make_element_morph(Parameter x)
モルフォロジー演算のエレメントを生成する.
Definition at line 243 of file Morph.h.
References DEBUG_MODE, MSGraph< T >::getm(), MSGraph< T >::gp, MSGraph< T >::isNull(), Max, Min, ON, Parameter32::pm, PRINT_MESG, SPHERE_ELEMENT, Xabs, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
00244 { 00245 int *p, n, m, r, c, i, j, k, z; 00246 int nn, xs, ir; 00247 double s, sn, cs, dr, dt, df, th, fi, rx, zz; 00248 MSGraph<T> vp, xp; 00249 00250 p = (int*)x.pm; 00251 m = p[0]; // mode 00252 r = p[1]; // hankei 00253 c = p[2]; // color 00254 s = p[3]/p[4]; // RZxy; 00255 00256 if (m==SPHERE_ELEMENT) { 00257 xs = 2*r + 1; 00258 vp.getm(xs, xs, (int)(xs*s+0.5)); 00259 if (vp.isNull()) return vp; 00260 00261 xp.xs = xs; 00262 xp.ys = xs; 00263 xp.zs = 1; 00264 00265 for (z=0; z<vp.zs; z++) { 00266 xp.gp = &vp.gp[z*vp.xs*vp.ys]; 00267 zz = Min(r, Xabs(((vp.zs-1.)/2.-z)/s)); 00268 ir = (int)(sqrt(Max(r*r-zz*zz, 0.0))+0.5); 00269 circle(xp, r, r, ir, c, ON); 00270 } 00271 } 00272 else { 00273 DEBUG_MODE PRINT_MESG("MAKE_ELEMENT_MORPH: no support mode = %d\n",m); 00274 exit(1); 00275 } 00276 00277 return vp; 00278 }
MSGraph<T> jbxl::medianFilter | ( | MSGraph< T > | xp, | |
int | ms = 3 | |||
) | [inline] |
template <typename t>=""> MSGraph<T> medianFilter(WSGraph<T> xp, int ms=3)
メディアンフィルタ処理を行なう.3D処理可.
xp | 対象となるグラフィックデータ構造体. | |
ms | フィルタの大きさ. |
Definition at line 806 of file Gmt.h.
References DEBUG_MODE, MSGraph< T >::gp, MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, MSGraph< T >::mimicry(), Min, PRINT_MESG, MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
00807 { 00808 int i, j, x, y, z, cx; 00809 int xx, yy, zz, cw, ux, mz; 00810 int kc, xc, zc, xs, ps; 00811 T* me; 00812 MSGraph<T> vp; 00813 00814 mz = Min(ms, xp.zs); 00815 me = (T*)malloc(ms*ms*mz*sizeof(T)); 00816 00817 vp.mimicry(xp); 00818 if (vp.isNull()) { 00819 free(me); 00820 DEBUG_MODE PRINT_MESG("medianFilter: No More Memory!!\n"); 00821 vp.state = JBXL_GRAPH_MEMORY_ERROR; 00822 return vp; 00823 } 00824 00825 kc = ms*ms*mz/2; 00826 xc = ms/2; 00827 zc = mz/2; 00828 xs = xp.xs; 00829 ps = xp.xs*xp.ys; 00830 z = xp.zs/2; 00831 for(y=xc; y<xp.ys-xc; y++) 00832 for(x=xc; x<xp.xs-xc; x++) { 00833 cx = z*ps + y*xs + x; 00834 i = 0; 00835 for (zz=-zc; zz<=zc; zz++) 00836 for (yy=-xc; yy<=xc; yy++) 00837 for (xx=-xc; xx<=xc; xx++) { 00838 cw = cx + xx + yy*xs + zz*ps; 00839 me[i++] = xp.gp[cw]; 00840 } 00841 for (i=0; i<ms*ms*mz-1; i++) 00842 for (j=i+1; j<ms*ms*mz; j++) { 00843 if (me[i]<me[j]) { 00844 ux = me[i]; 00845 me[i] = me[j]; 00846 me[j] = ux; 00847 } 00848 } 00849 vp.gp[cx-z*ps] = me[kc]; 00850 } 00851 00852 free(me); 00853 return vp; 00854 }
Vector<T> jbxl::MidPoint | ( | const Vector< T > | a, | |
const Vector< T > | b | |||
) | [inline] |
MSGraph<T> jbxl::Morphology | ( | MSGraph< T > | vp, | |
MSGraph< T > | xp, | |||
int | cc, | |||
int | mode | |||
) | [inline] |
template <typename t>=""> MSGraph<T> Morphology(MSGraph<T> vp, MSGraph<T> xp, int cc, int mode)
画像vpに対して,エレメントxpで,modeのモルフォロジー演算を行う.
現在は OPENING のmodeしかサポートしていない.
vp | 処理対象の元データ | |
xp | エレメント画像 | |
cc | 閾値.この輝度値以上の画素に対して演算を行う | |
mode | 演算の種類を指定 |
Definition at line 55 of file Morph.h.
References DEBUG_MODE, OPENING, opening_morph(), and PRINT_MESG.
00056 { 00057 MSGraph<T> wp; 00058 00059 if (mode==OPENING) wp = opening_morph(vp, xp, cc); 00060 else { 00061 DEBUG_MODE PRINT_MESG("MORPHOLOGY: サポートしていない演算です = %d\n", mode); 00062 } 00063 return wp; 00064 }
TGAImage jbxl::MSGraph2TGAImage | ( | MSGraph< T > | vp | ) | [inline] |
template <typename t>=""> TGAImage MSGraph2TGAImage(MSGraph<T> vp)
MSGraph型イメージデータを Tgaイメージデータに変換する
vp | MSGraph型イメージデータ |
JBXL_GRAPH_NODATA_ERROR | state データ無し | |
JBXL_GRAPH_MEMORY_ERROR | state メモリ確保エラー |
Definition at line 121 of file TgaTool.h.
References TGAImage::col, MSGraph< T >::color, TGAImage::free(), MSGraph< T >::gp, GRAPH_COLOR_ABGR, GRAPH_COLOR_ARGB, GRAPH_COLOR_BGR, GRAPH_COLOR_BGRA, GRAPH_COLOR_MA, GRAPH_COLOR_MONO, GRAPH_COLOR_RGB, GRAPH_COLOR_RGBA, GRAPH_COLOR_UNKNOWN, TGAImage::isNull(), MSGraph< T >::isNull(), JBXL_GRAPH_IVDARG_ERROR, JBXL_GRAPH_NODATA_ERROR, TGAImage::point(), TGAImage::set(), TGAImage::state, TGAImage::xs, MSGraph< T >::xs, TGAImage::ys, MSGraph< T >::ys, and MSGraph< T >::zs.
00122 { 00123 TGAImage tga; 00124 00125 if (vp.isNull()) { 00126 tga.state = JBXL_GRAPH_NODATA_ERROR; 00127 return tga; 00128 } 00129 00130 tga.set(vp.xs, vp.ys, vp.zs); 00131 if (tga.isNull()) return tga; 00132 00133 if (vp.color==GRAPH_COLOR_UNKNOWN) { 00134 if (vp.zs==1) vp.color = GRAPH_COLOR_MONO; 00135 else if (vp.zs==3) vp.color = GRAPH_COLOR_RGB; 00136 else if (vp.zs==4) vp.color = GRAPH_COLOR_RGBA; 00137 } 00138 00139 // 00140 if (vp.color==GRAPH_COLOR_BGRA || vp.color==GRAPH_COLOR_BGR || vp.color==GRAPH_COLOR_MONO || vp.color==GRAPH_COLOR_MA) { 00141 for (int k=0; k<tga.col; k++) { 00142 int zp = k*tga.xs*tga.ys; 00143 for (int j=0; j<tga.ys; j++) { 00144 int yp = zp + j*tga.xs; 00145 for (int i=0; i<tga.xs; i++) { 00146 tga.point(i, j, k) = (uByte)vp.gp[yp + i]; 00147 } 00148 } 00149 } 00150 } 00151 // 00152 else if (vp.color==GRAPH_COLOR_RGB || vp.color==GRAPH_COLOR_RGBA) { 00153 for (int k=0; k<3; k++) { 00154 int zp = (2-k)*tga.xs*tga.ys; 00155 for (int j=0; j<tga.ys; j++) { 00156 int yp = zp + j*tga.xs; 00157 for (int i=0; i<tga.xs; i++) { 00158 tga.point(i, j, k) = (uByte)vp.gp[yp + i]; 00159 } 00160 } 00161 } 00162 if (vp.color==GRAPH_COLOR_RGBA) { // αチャンネル 00163 int zp = 3*tga.xs*tga.ys; 00164 for (int j=0; j<tga.ys; j++) { 00165 int yp = zp + j*tga.xs; 00166 for (int i=0; i<tga.xs; i++) { 00167 tga.point(i, j, 3) = (uByte)vp.gp[yp + i]; 00168 } 00169 } 00170 } 00171 } 00172 // 00173 else if (vp.color==GRAPH_COLOR_ABGR) { 00174 for (int j=0; j<tga.ys; j++) { // αチャンネル 00175 int yp = j*tga.xs; 00176 for (int i=0; i<tga.xs; i++) { 00177 tga.point(i, j, 3) = (uByte)vp.gp[yp + i]; 00178 } 00179 } 00180 for (int k=1; k<4; k++) { 00181 int zp = k*tga.xs*tga.ys; 00182 for (int j=0; j<tga.ys; j++) { 00183 int yp = zp + j*tga.xs; 00184 for (int i=0; i<tga.xs; i++) { 00185 tga.point(i, j, k-1) = (uByte)vp.gp[yp + i]; 00186 } 00187 } 00188 } 00189 } 00190 // 00191 else if (vp.color==GRAPH_COLOR_ARGB) { 00192 for (int j=0; j<tga.ys; j++) { // αチャンネル 00193 int yp = j*tga.xs; 00194 for (int i=0; i<tga.xs; i++) { 00195 tga.point(i, j, 3) = (uByte)vp.gp[yp + i]; 00196 } 00197 } 00198 for (int k=1; k<4; k++) { 00199 int zp = (4-k)*tga.xs*tga.ys; 00200 for (int j=0; j<tga.ys; j++) { 00201 int yp = zp + j*tga.xs; 00202 for (int i=0; i<tga.xs; i++) { 00203 tga.point(i, j, k-1) = (uByte)vp.gp[yp + i]; 00204 } 00205 } 00206 } 00207 } 00208 else { 00209 tga.state = JBXL_GRAPH_IVDARG_ERROR; 00210 tga.free(); 00211 } 00212 00213 return tga; 00214 }
void jbxl::MSGraph_Box | ( | MSGraph< T > | vp, | |
int | x1, | |||
int | y1, | |||
int | x2, | |||
int | y2, | |||
int | cc, | |||
int | mode = OFF | |||
) | [inline] |
template <typename t>=""> void MSGraph_Box(MSGraph<T> vp, int x1, int y1, int x2, int y2, int cc, int mode=OFF)
点(x1,y1)-(x2,y2)を対角とした四角形を描く.線の濃度は cc.
modeが 1以上なら,四角形の内部を塗りつぶす.
vp | 操作対象となるグラフィックデータ構造体. | |
(x1,y1),(x2,y2) | 四角形の対角の座標. | |
cc | 線の濃度. | |
mode | ON なら四角形の内部の vp.zero〜cc-1 をccで塗りつぶす. |
box(vp, 100, 100, 200, 200, 1000, 0); // 100,100),(200,200)を対角とした四角形を描く
Definition at line 1061 of file Graph.h.
References MSGraph_Line(), MSGraph_Paint(), ON, and MSGraph< T >::zero.
01062 { 01063 MSGraph_Line(vp, x1, y1, x2, y1, cc); 01064 MSGraph_Line(vp, x2, y1, x2, y2, cc); 01065 MSGraph_Line(vp, x2, y2, x1, y2, cc); 01066 MSGraph_Line(vp, x1, y2, x1, y1, cc); 01067 01068 if (mode==ON) { 01069 MSGraph_Paint(vp, (x1+x2)/2, (y1+y2)/2, (int)vp.zero, cc-1, cc, 4); 01070 } 01071 return; 01072 }
void jbxl::MSGraph_changeColor | ( | MSGraph< T > | vp, | |
int | f, | |||
int | t | |||
) | [inline] |
Definition at line 789 of file Graph.h.
References MSGraph< T >::gp, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
void jbxl::MSGraph_Circle | ( | MSGraph< T > | vp, | |
int | x, | |||
int | y, | |||
int | r, | |||
int | cc, | |||
int | mode = OFF | |||
) | [inline] |
template <typename t>=""> void MSGraph_Circle(MSGraph<T> vp, int x, int y, int r, int cc, int mode=OFF)
2Dの円の描画.点(x,y)を中心に半径rで濃度 ccの円を書く.
vp | 操作対象となるグラフィックデータ構造体. | |
x,y | 円の中心の座標. | |
r | 円の半径. | |
cc | 線の濃度. | |
mode | ON なら円の内部の vp.zero〜cc-1 をccで塗りつぶす. |
Definition at line 1187 of file Graph.h.
References MSGraph< T >::gp, MSGraph_Paint(), ON, MSGraph< T >::point(), MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zero.
Referenced by MSGraph_Circle3D(), MSGraph_Pool(), and MSGraph_Sphere().
01188 { 01189 double yy, dy, dt; 01190 int i, nn, cx; 01191 int ix, iy, ux=1; 01192 int *px, *py; 01193 01194 if (r<=0) return; 01195 01196 px = (int*)malloc(sizeof(int)*(r+1)); 01197 py = (int*)malloc(sizeof(int)*(r+1)); 01198 if (px==NULL || py==NULL) { 01199 free(px); 01200 free(py); 01201 return; 01202 } 01203 01204 ix = 0; 01205 iy = r; 01206 yy = (double)r; 01207 nn = 0; 01208 px[0] = ix; 01209 py[0] = iy; 01210 01211 cx = (y+iy)*vp.xs + (x+ix); 01212 if (x+ix>=0 && x+ix<vp.xs && y+iy>=0 && y+iy<vp.ys) vp.gp[cx] = (T)cc; 01213 while(iy>=ix) { 01214 ix = ix + ux; 01215 dt = -ux/yy; 01216 dy = ix*dt; 01217 yy = yy + dy; 01218 iy = (int)yy; 01219 01220 if (x+ix>=0 && x+ix<vp.xs && y+iy>=0 && y+iy<vp.ys) vp.point(x+ix, y+iy) = (T)cc; 01221 nn++; 01222 px[nn] = ix; 01223 py[nn] = iy; 01224 } 01225 01226 for (i=0; i<=nn; i++) { 01227 ix = py[nn-i]; 01228 iy = px[nn-i]; 01229 if (x+ix>=0 && x+ix<vp.xs && y+iy>=0 && y+iy<vp.ys) vp.point(x+ix, y+iy) = (T)cc; 01230 } 01231 01232 for (i=0; i<=nn; i++) { 01233 ix = py[i]; 01234 iy = -px[i]; 01235 if (x+ix>=0 && x+ix<vp.xs && y+iy>=0 && y+iy<vp.ys) vp.point(x+ix, y+iy) = (T)cc; 01236 } 01237 01238 for (i=0; i<=nn; i++) { 01239 ix = px[nn-i]; 01240 iy = -py[nn-i]; 01241 if (x+ix>=0 && x+ix<vp.xs && y+iy>=0 && y+iy<vp.ys) vp.point(x+ix, y+iy) = (T)cc; 01242 } 01243 01244 for (i=0; i<=nn; i++) { 01245 ix = -px[i]; 01246 iy = -py[i]; 01247 if (x+ix>=0 && x+ix<vp.xs && y+iy>=0 && y+iy<vp.ys) vp.point(x+ix, y+iy) = (T)cc; 01248 } 01249 01250 for (i=0; i<=nn; i++) { 01251 ix = -py[nn-i]; 01252 iy = -px[nn-i]; 01253 if (x+ix>=0 && x+ix<vp.xs && y+iy>=0 && y+iy<vp.ys) vp.point(x+ix, y+iy) = (T)cc; 01254 } 01255 01256 for (i=0; i<=nn; i++) { 01257 ix = -py[i]; 01258 iy = px[i]; 01259 if (x+ix>=0 && x+ix<vp.xs && y+iy>=0 && y+iy<vp.ys) vp.point(x+ix, y+iy) = (T)cc; 01260 } 01261 01262 for (i=0; i<=nn; i++) { 01263 ix = -px[nn-i]; 01264 iy = py[nn-i]; 01265 if (x+ix>=0 && x+ix<vp.xs && y+iy>=0 && y+iy<vp.ys) vp.point(x+ix, y+iy) = (T)cc; 01266 } 01267 01268 if (mode==ON) MSGraph_Paint(vp, x, y, (int)vp.zero, cc-1, cc, 4); 01269 01270 free(px); 01271 free(py); 01272 }
void jbxl::MSGraph_Circle3D | ( | MSGraph< T > | vp, | |
Vector<> | ox, | |||
Vector<> | ex, | |||
int | rr, | |||
int | cc, | |||
int | mode = OFF | |||
) | [inline] |
template <typename t>=""> void MSGraph_Circle3D(MSGraph<T> vp, Vector<> ox, Vector<> ex, int rr, int cc, int mode=OFF)
3D円の描画.
vp | 操作対象となるグラフィックデータ構造体. | |
ox | 円の中心の座標ベクトル. | |
ex | 円の中心の法線ベクトル. | |
rr | 円の半径. | |
cc | 線の濃度. | |
mode | ON なら円の内部の vp.zero〜cc-1 をccで塗りつぶす. |
Definition at line 1289 of file Graph.h.
References MSGraph< T >::free(), MSGraph< T >::gp, Local2World(), MSGraph_Circle(), MSGraph< T >::xs, and MSGraph< T >::ys.
Referenced by MSGraph_Torus(), and wCircle3D().
01290 { 01291 MSGraph<T> xp(2*rr+3, 2*rr+3); 01292 if (xp.gp==NULL) return; 01293 01294 Vector<> oz((xp.xs-1)/2., (xp.ys-1)/2., 0.0); 01295 01296 MSGraph_Circle(xp, rr+1, rr+1, rr, cc, mode); 01297 Local2World(vp, xp, ox, oz, ex); 01298 xp.free(); 01299 }
void jbxl::MSGraph_Line | ( | MSGraph< T > | vp, | |
int | x1, | |||
int | y1, | |||
int | x2, | |||
int | y2, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> void MSGraph_Line(MSGraph<T> vp, int x1, int y1, int x2, int y2, int cc)
2Dのラインの描画.点(x1,y1) から点(x2,y2)へ濃度 cc の線を引く.
座標の範囲チェックあり.
vp | 操作対象となるグラフィックデータ構造体. | |
x1,y1 | 線の始点の座標. | |
x2,y2 | 線の終点の座標. | |
cc | 線の濃度. |
MSGraph_Line(vp, 100, 200, 300, 300, 200); // (100,200)から(300,300)へ濃度 200の線を引く
Definition at line 962 of file Graph.h.
References MSGraph< T >::point(), and MSGraph< T >::ys.
Referenced by MSGraph_Box(), and MSGraph_Triangle().
00963 { 00964 int thresh=0, index; 00965 int xunit=1; 00966 int yunit=1; 00967 int xdiff=x2-x1; 00968 int ydiff=y2-y1; 00969 00970 if (xdiff<0) { 00971 xdiff = -xdiff; 00972 xunit = -1; 00973 } 00974 if (ydiff<0) { 00975 ydiff = -ydiff; 00976 yunit = -1; 00977 } 00978 00979 if (xdiff>ydiff) { 00980 for (index=0; index<xdiff+1; index++) { 00981 if (x1>=0 && x1<vp.xs && y1>=0 && y1<vp.ys) { 00982 vp.point(x1, y1) = (T)cc; 00983 } 00984 x1 = x1 + xunit; 00985 thresh = thresh + ydiff; 00986 if (thresh>=xdiff) { 00987 thresh = thresh - xdiff; 00988 y1 = y1 + yunit; 00989 } 00990 } 00991 } 00992 else { 00993 for (index=0; index<ydiff+1; index++) { 00994 if (x1>=0 && x1<vp.xs && y1>=0 && y1<vp.ys) { 00995 vp.point(x1, y1) = (T)cc; 00996 } 00997 y1 = y1 + yunit; 00998 thresh = thresh + xdiff; 00999 if (thresh>=ydiff) { 01000 thresh = thresh - ydiff; 01001 x1 = x1 + xunit; 01002 } 01003 } 01004 } 01005 }
void jbxl::MSGraph_Line3D | ( | MSGraph< T > | vp, | |
int | x1, | |||
int | y1, | |||
int | z1, | |||
int | x2, | |||
int | y2, | |||
int | z2, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> void MSGraph_Line3D(MSGraph<T> vp, int x1, int y1, int z1, int x2, int y2, int z2, int cc)
3Dのラインの描画.点(x1,y1,z1)から点(x2,y2,z2)へ濃度 ccの線を引く.
座標の範囲チェックあり.
vp | 操作対象となるグラフィックデータ構造体. | |
x1,y1,z1 | 線の始点の座標. | |
x2,y2,z2 | 線の終点の座標. | |
cc | 線の濃度. |
Definition at line 1087 of file Graph.h.
References MSGraph< T >::point(), and MSGraph< T >::zs.
01088 { 01089 int i; 01090 int xx, yy, zz, dx, dy, dz; 01091 int ux=1, uy=1, uz=1; 01092 int sx=0, sy=0, sz=0; 01093 01094 dx = x2 - x1; 01095 dy = y2 - y1; 01096 dz = z2 - z1; 01097 01098 if (dx<0) { 01099 dx = -dx; 01100 ux = -1; 01101 } 01102 if (dy<0) { 01103 dy = -dy; 01104 uy = -1; 01105 } 01106 if (dz<0) { 01107 dz = -dz; 01108 uz = -1; 01109 } 01110 01111 xx = x1; 01112 yy = y1; 01113 zz = z1; 01114 01115 if (xx>=0 && xx<vp.xs && yy>=0 && yy<vp.ys && zz>=0 && zz<vp.zs) { 01116 vp.point(xx, yy, zz) = (T)cc; 01117 } 01118 if (dx>=dy && dx>=dz) { 01119 for (i=1; i<=dx; i++) { 01120 xx = xx + ux; 01121 sy = sy + dy; 01122 sz = sz + dz; 01123 if (sy>dx) { 01124 sy = sy - dx; 01125 yy = yy + uy; 01126 } 01127 if (sz>dx) { 01128 sz = sz - dx; 01129 zz = zz + uz; 01130 } 01131 if (xx>=0 && xx<vp.xs && yy>=0 && yy<vp.ys && zz>=0 && zz<vp.zs) { 01132 vp.point(xx, yy, zz) = (T)cc; 01133 } 01134 } 01135 } 01136 else if (dy>dx && dy>=dz) { 01137 for (i=1; i<=dy; i++) { 01138 yy = yy + uy; 01139 sx = sx + dx; 01140 sz = sz + dz; 01141 if (sx>dy) { 01142 sx = sx - dy; 01143 xx = xx + ux; 01144 } 01145 if (sz>dy) { 01146 sz = sz - dy; 01147 zz = zz + uz; 01148 } 01149 if (xx>=0 && xx<vp.xs && yy>=0 && yy<vp.ys && zz>=0 && zz<vp.zs) { 01150 vp.point(xx, yy, zz) = (T)cc; 01151 } 01152 } 01153 } 01154 else { 01155 for (i=1; i<=dz; i++) { 01156 zz = zz + uz; 01157 sx = sx + dx; 01158 sy = sy + dy; 01159 if (sx>dz) { 01160 sx = sx - dz; 01161 xx = xx + ux; 01162 } 01163 if (sy>dz) { 01164 sy = sy - dz; 01165 yy = yy + uy; 01166 } 01167 if (xx>=0 && xx<vp.xs && yy>=0 && yy<vp.ys && zz>=0 && zz<vp.zs) { 01168 vp.point(xx, yy, zz) = (T)cc; 01169 } 01170 } 01171 } 01172 }
int jbxl::MSGraph_Paint | ( | MSGraph< T > | vp, | |
int | x, | |||
int | y, | |||
int | mn, | |||
int | mx, | |||
int | cc, | |||
int | mode = 8 | |||
) | [inline] |
template <typename t>=""> int MSGraph_Paint(MSGraph<T> vp, int x, int y, int mn, int mx, int cc, int mode=8)
2Dグラフィックの塗りつぶし.
2Dグラフィック vpの点(x,y)から始めて, mn〜mx の輝度値を cc で塗りつぶす.
vp | グラフィックデータ構造体. | |
x | 塗りつぶしを始める点の x座標. | |
y | 塗りつぶしを始める点の y座標. | |
mn | 塗りつぶされる輝度値の最小値 | |
mx | 塗りつぶされる輝度値の最大値. | |
cc | 塗りつぶしの輝度値. | |
mode | モード. 8:8近傍の塗りつぶし. その他:4近傍の塗りつぶし |
Definition at line 814 of file Graph.h.
References DEBUG_MODE, MSGraph< T >::gp, PRINT_MESG, Xabs, MSGraph< T >::xs, and MSGraph< T >::ys.
Referenced by count_object_MSGraph(), Density_Mask(), MSGraph_Box(), MSGraph_Circle(), MSGraph_Paint3D(), MSGraph_Triangle(), and object_feature_MSGraph().
00815 { 00816 int i, j, k, ss; 00817 00818 if (cc<=mx && cc>=mn) { 00819 DEBUG_MODE PRINT_MESG("MSGRAPH_PAINT: WARNING: c = %d. Not be %d< c <%d\n", cc, mn, mx); 00820 return 0; 00821 } 00822 00823 if (x<0 || x>=vp.xs || y<0 || y>=vp.ys) return 0; 00824 if (vp.gp[y*vp.xs+x]>(T)mx || vp.gp[y*vp.xs+x]<(T)mn) return 0; 00825 00826 while(x>0) { 00827 if (vp.gp[y*vp.xs+x-1]>(T)mx || vp.gp[y*vp.xs+x-1]<(T)mn) break; 00828 x--; 00829 } 00830 k = x; 00831 00832 ss = 0; 00833 while(k<vp.xs) { 00834 if (vp.gp[y*vp.xs+k]>(T)mx || vp.gp[y*vp.xs+k]<(T)mn) break; 00835 vp.gp[y*vp.xs+k] = (T)cc; 00836 ss++; 00837 k++; 00838 } 00839 k--; 00840 00841 for (i=x; i<=k; i++){ 00842 if (y-1>=0 && y-1<vp.ys){ 00843 j = (y-1)*vp.xs+i; 00844 if (vp.gp[j]<=(T)mx && vp.gp[j]>=(T)mn) { 00845 ss += MSGraph_Paint(vp, i, y-1, mn, mx, cc, mode); 00846 } 00847 00848 if (Xabs(mode)==8) { // 8-neighborhood 00849 if (i-1>=0) { 00850 if (vp.gp[j-1]<=(T)mx && vp.gp[j-1]>=(T)mn) { 00851 ss += MSGraph_Paint(vp, i-1, y-1, mn, mx, cc, mode); 00852 } 00853 } 00854 if (i+1<vp.xs) { 00855 if (vp.gp[j+1]<=(T)mx && vp.gp[j+1]>=(T)mn) { 00856 ss += MSGraph_Paint(vp, i+1, y-1, mn, mx, cc, mode); 00857 } 00858 } 00859 } 00860 } 00861 00862 if (y+1>=0 && y+1<vp.ys){ 00863 j = (y+1)*vp.xs+i; 00864 if (vp.gp[j]<=(T)mx && vp.gp[j]>=(T)mn) { 00865 ss += MSGraph_Paint(vp, i, y+1, mn, mx, cc, mode); 00866 } 00867 00868 if (Xabs(mode)==8) { // 8-neighborhood 00869 if (i-1>=0) { 00870 if (vp.gp[j-1]<=(T)mx && vp.gp[j-1]>=(T)mn) { 00871 ss += MSGraph_Paint(vp, i-1, y+1, mn, mx, cc, mode); 00872 } 00873 } 00874 if (i+1<vp.xs) { 00875 if (vp.gp[j+1]<=(T)mx && vp.gp[j+1]>=(T)mn) { 00876 ss += MSGraph_Paint(vp, i+1, y+1, mn, mx, cc, mode); 00877 } 00878 } 00879 } 00880 } 00881 } 00882 return ss; 00883 }
int jbxl::MSGraph_Paint3D | ( | MSGraph< T > | vp, | |
int | x, | |||
int | y, | |||
int | z, | |||
int | mn, | |||
int | mx, | |||
int | cc, | |||
int | mode = 8 | |||
) | [inline] |
template <typename t>=""> int MSGraph_Paint3D(MSGraph<T> vp, int x, int y, int z, int mn, int mx, int cc, int mode=8)
3Dグラフィックの塗りつぶし.
3Dグラフィック vpの点(x,y,z)から始めて, mn〜mx の輝度値を cc で塗りつぶす.
vp | グラフィックデータ構造体. | |
x | 塗りつぶしを始める点の x座標. | |
y | 塗りつぶしを始める点の y座標. | |
z | 塗りつぶしを始める点の z座標. | |
mn | 塗りつぶされる輝度値の最小値 | |
mx | 塗りつぶされる輝度値の最大値. | |
cc | 塗りつぶしの輝度値. | |
mode | モード.マイナスの場合は途中経過(z)を表示. +-8:平面上で8近傍の塗りつぶし. その他:平面上で4近傍の塗りつぶし |
Definition at line 905 of file Graph.h.
References DEBUG_MODE, MSGraph< T >::gp, MSGraph_Paint(), PRINT_MESG, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
00906 { 00907 int i, j, ps, ss; 00908 MSGraph<T> xp; 00909 00910 ss = 0; 00911 ps = vp.xs*vp.ys; 00912 xp = vp; 00913 xp.zs = 1; 00914 xp.gp = &(vp.gp[z*ps]); 00915 00916 if (xp.gp[y*xp.xs+x]>(T)mx || xp.gp[y*xp.xs+x]<(T)mn) return 0; 00917 ss += MSGraph_Paint(xp, x, y, mn, mx, cc, mode); 00918 if (mode<0) { 00919 DEBUG_MODE PRINT_MESG("MSGRAPH_PAINT3D: zz = %d\n", z); 00920 } 00921 00922 for (i=0; i<ps; i++) { 00923 if (xp.gp[i]==(T)cc) { 00924 x = i%vp.xs; 00925 y = i/vp.xs; 00926 if (z-1>=0) { 00927 j = (z-1)*ps+y*vp.xs+x; 00928 if (vp.gp[j]<=(T)mx && vp.gp[j]>=(T)mn) { 00929 ss += MSGraph_Paint3D(vp, x, y, z-1, mn, mx, cc, mode); 00930 } 00931 } 00932 if (z+1<vp.zs) { 00933 j = (z+1)*ps+y*vp.xs+x; 00934 if (vp.gp[j]<=(T)mx && vp.gp[j]>=(T)mn) { 00935 ss += MSGraph_Paint3D(vp, x, y, z+1, mn, mx, cc, mode); 00936 } 00937 } 00938 } 00939 } 00940 00941 return ss; 00942 }
void jbxl::MSGraph_Pool | ( | MSGraph< T > | vp, | |
Vector<> | a, | |||
Vector<> | b, | |||
int | rr, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> void MSGraph_Pool(MSGraph<T> vp, Vector<> a, Vector<> b, int rr, int cc)
3D円柱の描画.中身はccで塗りつぶされる.
vp | 操作対象となるグラフィックデータ構造体. | |
a | 円柱上面の円の中心の座標ベクトル. | |
b | 円柱底面の円の中心の座標ベクトル. | |
rr | 円柱の半径. | |
cc | 線と塗りつぶしの濃度. |
Definition at line 1314 of file Graph.h.
References MSGraph< T >::free(), MSGraph< T >::gp, Local2World(), MSGraph_Circle(), Vector< T >::n, Vector< T >::norm(), ON, Vector< T >::set(), MSGraph< T >::set(), MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
01315 { 01316 int i, cz; 01317 Vector<> ox, oz; 01318 MSGraph<T> xp, pp; 01319 01320 ox = a - b; 01321 ox.norm(); 01322 xp.set(2*rr+3, 2*rr+3, (int)(ox.n + 0.5)); 01323 if (xp.gp==NULL) return; 01324 01325 pp = xp; 01326 for (i=0; i<xp.zs; i++) { 01327 cz = i*xp.xs*xp.ys; 01328 pp.gp = &(xp.gp[cz]); 01329 MSGraph_Circle(pp, rr+1, rr+1, rr, cc, ON); 01330 } 01331 01332 oz.set((xp.xs-1)/2.0, (xp.ys-1)/2.0, (xp.zs-1)/2.0); 01333 Local2World(vp, xp, (a+b)/2.0, oz, ox); 01334 xp.free(); 01335 return; 01336 }
void jbxl::MSGraph_Sphere | ( | MSGraph< T > | vp, | |
Vector<> | a, | |||
int | r, | |||
int | cc, | |||
int | mode = 1 | |||
) | [inline] |
template <typename t>=""> void MSGraph_Sphere(MSGraph<T> vp, Vector<> a, int r, int cc, int mode=1)
球の描画.境界チェックあり.
vp | 操作対象となるグラフィックデータ構造体. | |
a | 球の中心の座標ベクトル. | |
r | 球の半径. | |
cc | 線と塗りつぶしの濃度(mode=1のとき) | |
mode | モード. 1: 円を重ねて球を作る.中身はccで塗りつぶされる.それぞれの円の中心が,領域内にないと塗りつぶしに失敗する. -1: 極座標で球を作る.vpとの境界に壁を作る.set_vPoint()を使用. それ以外: 極座標で球を作る.set_vPoint()を使用. |
Definition at line 1401 of file Graph.h.
References MSGraph< T >::gp, MSGraph_Circle(), ON, PI, MSGraph< T >::set_vPoint(), Vector< T >::x, MSGraph< T >::xs, Vector< T >::y, MSGraph< T >::ys, Vector< T >::z, and MSGraph< T >::zs.
01402 { 01403 int i, j, k, rx, nn, s=1; // s: 壁を作る場合の境界からの距離 01404 double th, fi, cs, sn, cf, sf, dt; 01405 double xx, yy, zz; 01406 MSGraph<T> xp; 01407 01408 if (mode==1) { 01409 xp = vp; 01410 for (k=(int)(a.z-r+0.5); k<=(int)(a.z+r+0.5); k++) { 01411 if (k>=0 && k<vp.zs) { 01412 xp.gp = &vp.gp[k*vp.xs*vp.ys]; 01413 rx = (int)(sqrt(r*r-(a.z-k)*(a.z-k))+0.5); 01414 MSGraph_Circle(xp, (int)(a.x+0.5), (int)(a.y+0.5), rx, cc, ON); 01415 } 01416 } 01417 } 01418 else { 01419 nn = (int)(2*PI*r + 0.5)*2; 01420 dt = PI/nn; 01421 for (i=0; i<=nn; i++) { 01422 th = dt*i; 01423 sn = sin(th); 01424 cs = cos(th); 01425 zz = r*cs + a.z; 01426 if (mode==-1) { 01427 if (zz<s) zz = s; 01428 if (zz>vp.zs-s-1) zz = vp.zs - s - 1; 01429 } 01430 for (j=0; j<=2*nn; j++) { 01431 fi = dt*j; 01432 cf = cos(fi); 01433 sf = sin(fi); 01434 xx = r*sn*cf + a.x; 01435 yy = r*sn*sf + a.y; 01436 if (mode==-1) { 01437 if (xx<s) xx = s; 01438 if (yy<s) yy = s; 01439 if (xx>vp.xs-s-1) xx = vp.xs - s - 1; 01440 if (yy>vp.ys-s-1) yy = vp.ys - s - 1; 01441 } 01442 vp.set_vPoint(xx, yy, zz, (T)cc, ON); 01443 } 01444 } 01445 } 01446 return; 01447 }
void jbxl::MSGraph_Torus | ( | MSGraph< T > | vp, | |
Vector<> | ox, | |||
Vector<> | ex, | |||
int | rr, | |||
int | ra, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> void MSGraph_Torus(MSGraph<T> vp, Vector<> ox, Vector<> ex, int rr, int ra, int cc)
3Dトーラスの描画.中身はccで塗りつぶされる.
vp | 操作対象となるグラフィックデータ構造体. | |
ox | トーラスの中心の座標ベクトル. | |
ex | トーラスの中心の法線ベクトル. | |
rr | トーラスの半径(トーラスの中心から断面の円の中心まで). | |
ra | トーラスの断面の円の半径 | |
cc | 線と塗りつぶしの濃度. |
Definition at line 1354 of file Graph.h.
References MSGraph< T >::free(), MSGraph< T >::gp, Local2World(), MSGraph_Circle3D(), ON, PI, Vector< T >::set(), MSGraph< T >::set(), MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
01355 { 01356 int i, nn; 01357 double dt, th, xx, yy, zz, sn, cs; 01358 MSGraph<T> xp; 01359 Vector<> ve, vo, vz; 01360 01361 xp.set(2*(rr+ra)+3, 2*(rr+ra)+3, 2*ra+3); 01362 if (xp.gp==NULL) return; 01363 nn = (int)(2.0*PI*(rr+ra)*2 + 0.5); 01364 dt = 2.0*PI/nn; 01365 01366 zz = (xp.zs-1)/2.0; 01367 for (i=0; i<nn; i++) { 01368 th = dt*i; 01369 sn = sin(th); 01370 cs = cos(th); 01371 xx = (xp.xs-1)/2.0 + rr*cs; 01372 yy = (xp.ys-1)/2.0 - rr*sn; 01373 vo.set(xx, yy, zz); 01374 ve.set(sn, cs, 0.0); 01375 MSGraph_Circle3D(xp, vo, ve, ra, cc, ON); 01376 } 01377 vz.set((xp.xs-1)/2., (xp.ys-1)/2., (xp.zs-1)/2.); 01378 01379 Local2World(vp, xp, ox, vz, ex); 01380 xp.free(); 01381 01382 return; 01383 }
void jbxl::MSGraph_Triangle | ( | MSGraph< T > | vp, | |
int | x1, | |||
int | y1, | |||
int | x2, | |||
int | y2, | |||
int | x3, | |||
int | y3, | |||
int | cc, | |||
int | mode = OFF | |||
) | [inline] |
template <typename t>=""> void MSGraph_Triangle(MSGraph<T> vp, int x1, int y1, int x2, int y2, int x3, int y3, int cc, int mode=OFF)
2Dの三角形の描画.
点(x1,y1),(x2,y2),(x3,y3)の三点を頂点とした三角形を描く.
線の濃度は cc. modeが 1以上なら,三角形の内部を塗りつぶす.
vp | 操作対象となるグラフィックデータ構造体. | |
x1,y1 | 三角形の頂点1の座標. | |
x2,y2 | 三角形の頂点2の座標. | |
x3,y3 | 三角形の頂点3の座標. | |
cc | 線の濃度. | |
mode | ON なら三角形の内部の vp.zero〜cc-1 をccで塗りつぶす. |
// (100,100),(100,200),(200,100)を頂点とした三角形(直角三角形)を描き,内部を塗りつぶす
triangle(vp, 100, 100, 100, 200, 200, 100, 1000, 1);
Definition at line 1031 of file Graph.h.
References MSGraph_Line(), MSGraph_Paint(), ON, and MSGraph< T >::zero.
01032 { 01033 MSGraph_Line(vp, x1, y1, x2, y2, cc); 01034 MSGraph_Line(vp, x2, y2, x3, y3, cc); 01035 MSGraph_Line(vp, x3, y3, x1, y1, cc); 01036 01037 if (mode==ON) { 01038 MSGraph_Paint(vp, (x1+x2+x3)/3, (y1+y2+y3)/3, (int)vp.zero, cc-1, cc, 4); 01039 } 01040 return; 01041 }
MSGraph<R> jbxl::MSMaskFilter | ( | MSGraph< R > | vp, | |
MSGraph< T > | filter, | |||
int | mode = FILTER_NON | |||
) | [inline] |
Definition at line 993 of file Gmt.h.
References DEBUG_MODE, FILTER_ABS, FILTER_MINMAX, FILTER_NORM, MSGraph< T >::get_minmax(), MSGraph< T >::gp, JBXL_GRAPH_NODATA_ERROR, MSGraph< T >::max, MSGraph< T >::mimicry(), MSGraph< T >::min, MSGraph< T >::norm, MSGraph< T >::point(), PRINT_MESG, MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
00994 { 00995 MSGraph<R> xp; 00996 00997 if (vp.xs<filter.xs || vp.ys<filter.ys || vp.zs<filter.zs) { 00998 DEBUG_MODE PRINT_MESG("MSMaskFilter: Error: mismach filter dimension!!\n"); 00999 xp.state = JBXL_GRAPH_NODATA_ERROR; 01000 return xp; 01001 } 01002 if (filter.norm==0.0) { 01003 DEBUG_MODE PRINT_MESG("MSMaskFilter: Error: norm of filter is zero!!\n"); 01004 xp.state = JBXL_GRAPH_NODATA_ERROR; 01005 return xp; 01006 } 01007 01008 xp.mimicry(vp); 01009 01010 int xs = filter.xs/2; 01011 int ys = filter.ys/2; 01012 int zs = filter.zs/2; 01013 01014 for (int k=zs; k<xp.zs-zs; k++) { 01015 for (int j=ys; j<xp.ys-ys; j++) { 01016 for (int i=xs; i<xp.xs-xs; i++) { 01017 01018 T conv = (T)0; 01019 for (int n=-zs; n<=zs; n++) { 01020 for (int m=-ys; m<=ys; m++) { 01021 for (int l=-xs; l<=xs; l++) { 01022 conv += filter.point(xs+l, ys+m, zs+n) * vp.point(i+l, j+m, k+n); 01023 } 01024 } 01025 } 01026 01027 R pt = (R)(conv/filter.norm); 01028 01029 if (mode==FILTER_ABS && pt<(R)0) pt = -pt; 01030 else if (mode==FILTER_MINMAX) { 01031 if (pt<(R)vp.min) pt = (R)vp.min; 01032 else if (pt>(R)vp.max) pt = (R)vp.max; 01033 } 01034 xp.point(i, j, k) = pt; 01035 } 01036 } 01037 } 01038 01039 xp.get_minmax(); 01040 if (mode==FILTER_NORM && xp.max!=xp.min) { 01041 for (int i=0; i<xp.xs*xp.ys*xp.zs; i++) { 01042 xp.gp[i] = (R)(((T)(xp.gp[i]-xp.min)*(vp.max-vp.min))/(xp.max-xp.min) + vp.min); 01043 } 01044 xp.get_minmax(); 01045 } 01046 01047 return xp; 01048 }
MSGraph<R> jbxl::Nabla | ( | MSGraph< T > | vp | ) | [inline] |
template <typename R, typename T> MSGraph<R> Nabla(MSGraph<T> vp)
グラフィックデータの ナブラの絶対値を計算する(Sobel).
vp | 計算対象となるグラフィックデータ構造体. |
Definition at line 713 of file Gmt.h.
References DEBUG_MODE, MSGraph< T >::free(), MSGraph< T >::gp, MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, MSGraph< T >::mimicry(), PRINT_MESG, MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
00714 { 00715 int i; 00716 R xx, yy, zz; 00717 MSGraph<R> px, py, pz, nv; 00718 00719 nv.mimicry(vp); 00720 if (nv.isNull()) { 00721 DEBUG_MODE PRINT_MESG("Nabla: No More Memory!!\n"); 00722 nv.state = JBXL_GRAPH_MEMORY_ERROR; 00723 return nv; 00724 } 00725 00726 px = xSobel<R>(vp); 00727 if (px.gp==NULL) { 00728 nv.state = px.state; 00729 return nv; 00730 } 00731 00732 py = ySobel<R>(vp); 00733 if (py.gp==NULL) { 00734 px.free(); 00735 nv.state = py.state; 00736 return nv; 00737 } 00738 00739 pz = zSobel<R>(vp); 00740 if (pz.gp==NULL) { 00741 px.free(); 00742 py.free(); 00743 nv.state = pz.state; 00744 return nv; 00745 } 00746 00747 for (i=0; i<vp.xs*vp.ys*vp.zs; i++) { 00748 xx = px.gp[i]; 00749 yy = py.gp[i]; 00750 zz = pz.gp[i]; 00751 nv.gp[i] = (R)sqrt((double)xx*xx + yy*yy + zz*zz); 00752 } 00753 00754 px.free(); 00755 py.free(); 00756 pz.free(); 00757 00758 return nv; 00759 }
AffineTrans<T>* jbxl::newAffineTrans | ( | AffineTrans< T > | p | ) | [inline] |
Definition at line 384 of file Rotation.h.
References AffineTrans< T >::dup().
Vector<T> jbxl::NewellMethod | ( | Vector< T > | v1, | |
Vector< T > | v2, | |||
Vector< T > | v3 | |||
) | [inline] |
Definition at line 277 of file Vector.h.
References Vector< T >::c, Min, Vector< T >::n, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Referenced by FacetTriData::ComputeTriNormal(), and NewellMethod3().
00278 { 00279 Vector<T> vect; 00280 00281 vect.x = (v1.y-v2.y)*(v1.z+v2.z) + (v2.y-v3.y)*(v2.z+v3.z) + (v3.y-v1.y)*(v3.z+v1.z); 00282 vect.y = (v1.z-v2.z)*(v1.x+v2.x) + (v2.z-v3.z)*(v2.x+v3.x) + (v3.z-v1.z)*(v3.x+v1.x); 00283 vect.z = (v1.x-v2.x)*(v1.y+v2.y) + (v2.x-v3.x)*(v2.y+v3.y) + (v3.x-v1.x)*(v3.y+v1.y); 00284 vect.n = 0.0; 00285 vect.c = Min(v1.c, v2.c); 00286 vect.c = Min(v3.c, vect.c); 00287 00288 return vect; 00289 }
Vector<T> jbxl::NewellMethod3 | ( | Vector< T > | v1, | |
Vector< T > | v2, | |||
Vector< T > | v3 | |||
) | [inline] |
Definition at line 292 of file Vector.h.
References NewellMethod().
00293 { 00294 return NewellMethod(v1, v2, v3); 00295 }
Vector<T> jbxl::NewellMethod4 | ( | Vector< T > | v1, | |
Vector< T > | v2, | |||
Vector< T > | v3, | |||
Vector< T > | v4 | |||
) | [inline] |
Definition at line 298 of file Vector.h.
References Vector< T >::c, Min, Vector< T >::n, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
00299 { 00300 Vector<T> vect; 00301 00302 vect.x = (v1.y-v2.y)*(v1.z+v2.z) + (v2.y-v3.y)*(v2.z+v3.z) + (v3.y-v4.y)*(v3.z+v4.z) + (v4.y-v1.y)*(v4.z+v1.z); 00303 vect.y = (v1.z-v2.z)*(v1.x+v2.x) + (v2.z-v3.z)*(v2.x+v3.x) + (v3.z-v4.z)*(v3.x+v4.x) + (v4.z-v1.z)*(v4.x+v1.x); 00304 vect.z = (v1.x-v2.x)*(v1.y+v2.y) + (v2.x-v3.x)*(v2.y+v3.y) + (v3.x-v4.x)*(v3.y+v4.y) + (v4.x-v1.x)*(v4.y+v1.y); 00305 vect.n = 0.0; 00306 vect.c = Min(v1.c, v2.c); 00307 vect.c = Min(v3.c, vect.c); 00308 vect.c = Min(v4.c, vect.c); 00309 return vect; 00310 }
MaterialParam* jbxl::newMaterialParam | ( | MaterialParam | p | ) | [inline] |
Definition at line 284 of file MaterialParam.h.
References MaterialParam::dup().
int nonZeroBoxel | ( | MSGraph< T > | vp, | |
int | n | |||
) | [inline] |
Definition at line 220 of file Thinning.h.
References MSGraph< T >::gp, MSGraph< T >::xs, and MSGraph< T >::ys.
Referenced by centerLine().
00221 { 00222 int m, xs, ps; 00223 00224 ps = vp.xs*vp.ys; 00225 xs = vp.xs; 00226 00227 m = 0; 00228 if (vp.gp[n+1] !=0) m++; 00229 if (vp.gp[n-1] !=0) m++; 00230 if (vp.gp[n+xs] !=0) m++; 00231 if (vp.gp[n-xs] !=0) m++; 00232 if (vp.gp[n+ps] !=0) m++; 00233 if (vp.gp[n-ps] !=0) m++; 00234 if (vp.gp[n+1+xs] !=0) m++; 00235 if (vp.gp[n+1-xs] !=0) m++; 00236 if (vp.gp[n-1+xs] !=0) m++; 00237 if (vp.gp[n-1-xs] !=0) m++; 00238 if (vp.gp[n+1+ps] !=0) m++; 00239 if (vp.gp[n+1-ps] !=0) m++; 00240 if (vp.gp[n-1+ps] !=0) m++; 00241 if (vp.gp[n-1-ps] !=0) m++; 00242 if (vp.gp[n+xs+ps] !=0) m++; 00243 if (vp.gp[n+xs-ps] !=0) m++; 00244 if (vp.gp[n-xs+ps] !=0) m++; 00245 if (vp.gp[n-xs-ps] !=0) m++; 00246 if (vp.gp[n+1+xs+ps]!=0) m++; 00247 if (vp.gp[n+1+xs-ps]!=0) m++; 00248 if (vp.gp[n+1-xs+ps]!=0) m++; 00249 if (vp.gp[n+1-xs-ps]!=0) m++; 00250 if (vp.gp[n-1+xs+ps]!=0) m++; 00251 if (vp.gp[n-1+xs-ps]!=0) m++; 00252 if (vp.gp[n-1-xs+ps]!=0) m++; 00253 if (vp.gp[n-1-xs-ps]!=0) m++; 00254 00255 return m; 00256 }
Vector<double> jbxl::object_feature_MSGraph | ( | MSGraph< T > | vp, | |
int | mn, | |||
int | mx | |||
) | [inline] |
template <typename t>=""> Vector<double> object_feature_MSGraph(MSGraph<T> vp, int mn, int mx)
2D画像において,mn〜mxの輝度値のオブジェクトの分散度(円形度の逆数)を計算する.
穴空きのオブジェクトも計算可能.独自アルゴリズム.
vp | 画像データ | |
mn | 輝度値の最小 | |
mx | 輝度値の最大 |
Vector<double>.x | 領域の個数 | |
Vector<double>.y | 全面積 | |
Vector<double>.z | 分散度 |
Definition at line 131 of file Graph.h.
References MSGraph< T >::free(), MSGraph< T >::gp, MSGraph< T >::mimicry(), MSGraph_Paint(), Vector< T >::x, MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00132 { 00133 int cnt = 0; 00134 int nx, ny; 00135 MSGraph<T> pp; 00136 Vector<double> vt; 00137 00138 pp.mimicry(vp); 00139 for (int i=0; i<pp.xs*pp.ys*pp.zs; i++) pp.gp[i] = vp.gp[i]; 00140 00141 MSGraph_Paint(pp, 0, 0, pp.zero, pp.zero, mx+1, 4); 00142 00143 for (int j=0; j<pp.ys; j++) { 00144 ny = pp.xs*j; 00145 for (int i=0; i<pp.xs; i++) { 00146 nx = ny + i; 00147 if (pp.gp[nx]==pp.zero) { 00148 MSGraph_Paint(pp, i, j, pp.zero, pp.zero, mx, 8); 00149 } 00150 } 00151 } 00152 00153 MSGraph_Paint(pp, 0, 0, mx+1, mx+1, pp.zero, 4); 00154 00155 vt = dgree_circle_MSGraph<T>(pp); 00156 00157 for (int j=0; j<pp.ys; j++) { 00158 ny = pp.xs*j; 00159 for (int i=0; i<pp.xs; i++) { 00160 nx = ny + i; 00161 if (pp.gp[nx]>=mn && pp.gp[nx]<=mx) { 00162 MSGraph_Paint(pp, i, j, mn, mx, pp.zero, 8); 00163 cnt++; 00164 } 00165 } 00166 } 00167 pp.free(); 00168 vt.x = (double)cnt; 00169 00170 return vt; 00171 }
long int OctreeGetter | ( | OctreeNode * | p, | |
BREP_VERTEX ** | vtx, | |||
long int | counter | |||
) |
Definition at line 979 of file Brep.cpp.
References OctreeNode::child, BREP_VERTEX::index, and OctreeNode::vertex.
Referenced by GetOctreeVertices().
00980 { 00981 if (p->vertex!=NULL) { 00982 if (vtx!=NULL && p->vertex->index>=0) vtx[p->vertex->index] = p->vertex; 00983 counter++; 00984 } 00985 00986 for (int i=0; i<8; i++) { 00987 if (p->child[i]!=NULL) { 00988 counter = OctreeGetter(p->child[i], vtx, counter); 00989 } 00990 } 00991 00992 return counter; 00993 }
MSGraph<T> jbxl::opening_morph | ( | MSGraph< T > | vp, | |
MSGraph< T > | xp, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> MSGraph<T> opening_morph(MSGraph<T> vp, MSGraph<T> xp, int cc)
画像vpに対して,エレメントxpで,modeのモルフォロジー演算のオープニングを行う.
元画像は保持される.
vp | 処理対象の元データ | |
xp | エレメント画像 | |
cc | 閾値.この輝度値以上の画素に対して演算を行う |
Definition at line 79 of file Morph.h.
References copy_morph_element(), MSGraph< T >::gp, MSGraph< T >::isNull(), point_open_morph(), MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
Referenced by Morphology().
00080 { 00081 int i, j, k, ks, cz, cy, cx, ps; 00082 bool err; 00083 MSGraph<T> wp(vp.xs, vp.ys, vp.zs); 00084 if (wp.isNull()) return wp; 00085 00086 ps = vp.xs*vp.ys; 00087 for (k=0; k<vp.zs; k++) { 00088 cz = k*ps; 00089 for (j=0; j<vp.ys; j++) { 00090 cy = cz + j*vp.xs; 00091 for (i=0; i<vp.xs; i++) { 00092 cx = cy + i; 00093 if (vp.gp[cx]>=cc) { 00094 err = point_open_morph(vp, i, j, k, xp, cc); 00095 if (err) copy_morph_element(wp, i, j, k, xp); 00096 } 00097 } 00098 } 00099 } 00100 00101 return wp; 00102 }
bool jbxl::operator!= | ( | const UVMap< T > | a, | |
const UVMap< T > | b | |||
) | [inline] |
Definition at line 671 of file Vector.h.
References UVMap< T >::u, and UVMap< T >::v.
bool jbxl::operator!= | ( | const Vector< T > | v1, | |
const Vector< T > | v2 | |||
) | [inline] |
Definition at line 195 of file Vector.h.
References Vector< T >::x, Vector< T >::y, and Vector< T >::z.
bool jbxl::operator!= | ( | const TVector< T > | v1, | |
const TVector< T > | v2 | |||
) | [inline] |
Definition at line 157 of file TVector.h.
References TVector< T >::t, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
bool jbxl::operator!= | ( | const Quaternion< T > | q1, | |
const Quaternion< T > | q2 | |||
) | [inline] |
Definition at line 111 of file Rotation.h.
References Quaternion< T >::s, Quaternion< T >::x, Quaternion< T >::y, and Quaternion< T >::z.
UVMap<T> jbxl::operator* | ( | const UVMap< T > | a, | |
const R | d | |||
) | [inline] |
Definition at line 655 of file Vector.h.
References UVMap< T >::d, UVMap< T >::u, and UVMap< T >::v.
UVMap<T> jbxl::operator* | ( | const R | d, | |
const UVMap< T > | a | |||
) | [inline] |
Definition at line 651 of file Vector.h.
References UVMap< T >::d, UVMap< T >::u, and UVMap< T >::v.
T jbxl::operator* | ( | const Vector< T > | a, | |
const Vector< T > | b | |||
) | [inline] |
Definition at line 187 of file Vector.h.
References Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Vector<T> jbxl::operator* | ( | const Vector< T > | a, | |
const R | d | |||
) | [inline] |
Definition at line 165 of file Vector.h.
References Vector< T >::c, Vector< T >::d, Vector< T >::n, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Vector<T> jbxl::operator* | ( | const R | d, | |
const Vector< T > | a | |||
) | [inline] |
Definition at line 161 of file Vector.h.
References Vector< T >::c, Vector< T >::d, Vector< T >::n, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
T jbxl::operator* | ( | const TVector< T > | a, | |
const TVector< T > | b | |||
) | [inline] |
Definition at line 181 of file TVector.h.
References Vector< T >::x, Vector< T >::y, and Vector< T >::z.
TVector<T> jbxl::operator* | ( | const TVector< T > | a, | |
const R | d | |||
) | [inline] |
Definition at line 136 of file TVector.h.
References TVector< T >::t, Vector< T >::x, Xabs, Vector< T >::y, and Vector< T >::z.
00137 { return TVector<T>(a.x*(T)d, a.y*(T)d, a.z*(T)d, a.t*Xabs((T)d));}
TVector<T> jbxl::operator* | ( | const R | d, | |
const TVector< T > | a | |||
) | [inline] |
Definition at line 132 of file TVector.h.
References TVector< T >::t, Vector< T >::x, Xabs, Vector< T >::y, and Vector< T >::z.
00133 { return TVector<T>(a.x*(T)d, a.y*(T)d, a.z*(T)d, a.t*Xabs((T)d));}
AffineTrans<T> jbxl::operator* | ( | const AffineTrans< T > | a, | |
const AffineTrans< T > | b | |||
) | [inline] |
変換の合成:A*B => Bの変換 -> Aの変換
Definition at line 395 of file Rotation.h.
References AffineTrans< T >::isInverse, Min, AffineTrans< T >::rotate, AffineTrans< T >::scale, AffineTrans< T >::set(), Vector< T >::set(), and AffineTrans< T >::shift.
00396 { 00397 Quaternion<T> rotate = a.rotate * b.rotate; 00398 Vector<T> shift = a.shift + b.shift; 00399 // 00400 Vector<T> scale; 00401 scale.set(a.scale.x*b.scale.x, a.scale.y*b.scale.y, a.scale.z*b.scale.z, (T)0.0, Min(a.scale.c, b.scale.c)); 00402 00403 AffineTrans<T> affine; 00404 affine.set(scale, rotate, shift, a.isInverse); 00405 00406 return affine; 00407 }
Quaternion<T> jbxl::operator* | ( | const Vector< T > | v, | |
const Quaternion< T > | q | |||
) | [inline] |
Definition at line 170 of file Rotation.h.
References Vector< T >::c, Quaternion< T >::c, Quaternion< T >::init(), Min, Vector< T >::n, Quaternion< T >::s, Quaternion< T >::set(), Quaternion< T >::x, Vector< T >::x, Quaternion< T >::y, Vector< T >::y, Quaternion< T >::z, and Vector< T >::z.
00171 { 00172 Quaternion<T> quat; 00173 if (q.c<(T)0.0 || v.c<(T)0.0) quat.init(-(T)1.0); 00174 else quat.set(-v.x*q.x-v.y*q.y-v.z*q.z, v.x*q.s+v.y*q.z-v.z*q.y, 00175 v.y*q.s+v.z*q.x-v.x*q.z, v.z*q.s+v.x*q.y-v.y*q.x, (T)v.n, (T)Min(v.c, q.c)); 00176 return quat; 00177 }
Quaternion<T> jbxl::operator* | ( | const Quaternion< T > | q, | |
const Vector< T > | v | |||
) | [inline] |
Definition at line 159 of file Rotation.h.
References Vector< T >::c, Quaternion< T >::c, Quaternion< T >::init(), Min, Vector< T >::n, Quaternion< T >::s, Quaternion< T >::set(), Vector< T >::x, Quaternion< T >::x, Vector< T >::y, Quaternion< T >::y, Vector< T >::z, and Quaternion< T >::z.
00160 { 00161 Quaternion<T> quat; 00162 if (q.c<(T)0.0 || v.c<(T)0.0) quat.init(-(T)1.0); 00163 else quat.set(-q.x*v.x-q.y*v.y-q.z*v.z, q.s*v.x+q.y*v.z-q.z*v.y, 00164 q.s*v.y+q.z*v.x-q.x*v.z, q.s*v.z+q.x*v.y-q.y*v.x, v.n, Min(q.c, v.c)); 00165 return quat; 00166 }
Quaternion<T> jbxl::operator* | ( | const Quaternion< T > | a, | |
const Quaternion< T > | b | |||
) | [inline] |
演算順序 A*B = Bの回転 -> Aの回転
Definition at line 148 of file Rotation.h.
References Quaternion< T >::c, Quaternion< T >::init(), Min, Quaternion< T >::s, Quaternion< T >::set(), Quaternion< T >::x, Quaternion< T >::y, and Quaternion< T >::z.
00149 { 00150 Quaternion<T> quat; 00151 if (a.c<(T)0.0 || b.c<(T)0.0) quat.init(-(T)1.0); 00152 else quat.set(a.s*b.s-a.x*b.x-a.y*b.y-a.z*b.z, a.s*b.x+a.x*b.s+a.y*b.z-a.z*b.y, 00153 a.s*b.y+a.y*b.s+a.z*b.x-a.x*b.z, a.s*b.z+a.z*b.s+a.x*b.y-a.y*b.x, (T)1.0, Min(a.c, b.c)); 00154 return quat; 00155 }
Quaternion<T> jbxl::operator* | ( | const Quaternion< T > | a, | |
const R | d | |||
) | [inline] |
Definition at line 137 of file Rotation.h.
References Quaternion< T >::c, Quaternion< T >::n, Quaternion< T >::s, Quaternion< T >::x, Quaternion< T >::y, and Quaternion< T >::z.
Quaternion<T> jbxl::operator* | ( | const R | d, | |
const Quaternion< T > | a | |||
) | [inline] |
Definition at line 133 of file Rotation.h.
References Quaternion< T >::c, Quaternion< T >::n, Quaternion< T >::s, Quaternion< T >::x, Quaternion< T >::y, and Quaternion< T >::z.
Matrix<T> jbxl::operator* | ( | const Matrix< T > | a, | |
const R | d | |||
) | [inline] |
Definition at line 436 of file Matrix++.h.
References Matrix< T >::mx, Matrix< T >::n, Matrix< T >::r, and Matrix< T >::sz.
Matrix<T> jbxl::operator* | ( | const R | d, | |
const Matrix< T > | a | |||
) | [inline] |
Definition at line 426 of file Matrix++.h.
References Matrix< T >::mx, Matrix< T >::n, Matrix< T >::r, and Matrix< T >::sz.
Vector<T> jbxl::operator* | ( | const Matrix< T > | a, | |
const Vector< T > | v | |||
) | [inline] |
template <typename t>=""> Matrix<T> operator * (const Matrix<T> a, const Matrix<T> b)
マトリックスとベクトルの掛け算.
マトリックス a と 3Dベクトル vを掛け算して,結果のベクトルを返す.
a | 掛けられるマトリックス. | |
v | 掛けるベクトル. |
Definition at line 368 of file Matrix++.h.
References Vector< T >::c, Matrix< T >::free(), Matrix< T >::mx, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
00369 { 00370 Vector<T> vct(0.0, 0.0, 0.0, 0.0, -1.0); 00371 00372 Matrix<T> b(1, 3); 00373 b.mx[0] = v.x; 00374 b.mx[1] = v.y; 00375 b.mx[2] = v.z; 00376 00377 Matrix<T> c = a*b; 00378 b.free(); 00379 00380 if (c.mx==NULL) return vct; 00381 vct.x = c.mx[0]; 00382 vct.y = c.mx[1]; 00383 vct.z = c.mx[2]; 00384 vct.c = v.c; 00385 c.free(); 00386 00387 return vct; 00388 }
Matrix<T> jbxl::operator* | ( | const Matrix< T > | a, | |
const Matrix< T > | b | |||
) | [inline] |
template <typename t>=""> Matrix<T> operator * (const Matrix<T> a, const Matrix<T> b)
マトリックスの掛け算.
マトリックス a, bを掛け算して,結果のマトリックスを返す.
a | 掛けられるマトリックス. | |
b | 掛けるマトリックス. |
Definition at line 297 of file Matrix++.h.
References Matrix< T >::getm(), Matrix< T >::mx, Matrix< T >::n, Matrix< T >::r, and Matrix< T >::sz.
00298 { 00299 int i, j, k, n, ii, aa, bb; 00300 int *sz, *sa, *sb, *sc, *cx; 00301 T st; 00302 Matrix<T> c; 00303 00304 if (a.mx==NULL || b.mx==NULL) return c; 00305 if (a.sz[a.n-1]!=b.sz[0]) return c; 00306 00307 n = a.n + b.n - 2; 00308 sz = (int*)malloc(n*sizeof(int)); 00309 if (sz==NULL) return c; 00310 sa = (int*)malloc(a.n*sizeof(int)); 00311 if (sa==NULL) {free(sz); return c;} 00312 sb = (int*)malloc(b.n*sizeof(int)); 00313 if (sb==NULL) {free(sz); free(sa); return c;} 00314 sc = (int*)malloc(n*sizeof(int)); 00315 if (sc==NULL) {free(sz); free(sa); free(sb); return c;} 00316 cx = (int*)malloc(n*sizeof(int)); 00317 if (cx==NULL) {free(sz); free(sa); free(sb); free(sc); return c;} 00318 00319 for (i=0; i<a.n-1; i++) sz[i] = a.sz[i]; 00320 for (i=1; i<b.n; i++) sz[a.n-2+i] = b.sz[i]; 00321 00322 sa[a.n-1] = sb[b.n-1] = sc[n-1] = 1; 00323 for (i=a.n-2; i>=0; i--) sa[i] = sa[i+1]*a.sz[i+1]; 00324 for (i=b.n-2; i>=0; i--) sb[i] = sb[i+1]*b.sz[i+1]; 00325 for (i=n-2; i>=0; i--) sc[i] = sc[i+1]*sz[i+1]; 00326 00327 c.getm(n, sz); 00328 00329 if (c.sz!=NULL) { 00330 for (i=0; i<c.r; i++) { 00331 ii = i; 00332 for (j=0; j<c.n; j++) { 00333 cx[j] = ii / sc[j]; 00334 ii = ii % sc[j]; 00335 } 00336 aa = bb = 0; 00337 for (j=0; j<a.n-1; j++) aa = aa + sa[j]*cx[j]; 00338 for (j=1; j<b.n; j++) bb = bb + sb[j]*cx[j+a.n-2]; 00339 00340 st = (T)0; 00341 for (k=0; k<b.sz[0]; k++) st = st + a.mx[k+aa]*b.mx[bb+sb[0]*k]; 00342 c.mx[i] = st; 00343 } 00344 } 00345 00346 free(sz); 00347 free(sa); 00348 free(sb); 00349 free(sc); 00350 free(cx); 00351 00352 return c; 00353 }
UVMap<T> jbxl::operator+ | ( | const R | c, | |
UVMap< T > | a | |||
) | [inline] |
Definition at line 635 of file Vector.h.
References UVMap< T >::d, UVMap< T >::u, and UVMap< T >::v.
UVMap<T> jbxl::operator+ | ( | const UVMap< T > | a, | |
R | c | |||
) | [inline] |
Definition at line 631 of file Vector.h.
References UVMap< T >::d, UVMap< T >::u, and UVMap< T >::v.
UVMap<T> jbxl::operator+ | ( | const UVMap< T > | a, | |
const UVMap< T > | b | |||
) | [inline] |
Definition at line 627 of file Vector.h.
References UVMap< T >::d, UVMap< T >::u, and UVMap< T >::v.
Vector<T> jbxl::operator+ | ( | const R | c, | |
Vector< T > | a | |||
) | [inline] |
Definition at line 145 of file Vector.h.
References Vector< T >::c, Vector< T >::d, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Vector<T> jbxl::operator+ | ( | const Vector< T > | a, | |
R | c | |||
) | [inline] |
Definition at line 141 of file Vector.h.
References Vector< T >::c, Vector< T >::d, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Vector<T> jbxl::operator+ | ( | const Vector< T > | a, | |
const Vector< T > | b | |||
) | [inline] |
Definition at line 137 of file Vector.h.
References Vector< T >::c, Vector< T >::d, Min, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
00138 { return Vector<T>(a.x+b.x, a.y+b.y, a.z+b.z, 0.0, Min(a.c, b.c), a.d); }
TVector<T> jbxl::operator+ | ( | const TVector< T > | a, | |
const R | d | |||
) | [inline] |
Definition at line 107 of file TVector.h.
References TVector< T >::t, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
TVector<T> jbxl::operator+ | ( | const R | d, | |
const TVector< T > | a | |||
) | [inline] |
Definition at line 103 of file TVector.h.
References TVector< T >::t, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
TVector<T> jbxl::operator+ | ( | const TVector< T > | a, | |
const TVector< T > | b | |||
) | [inline] |
Definition at line 90 of file TVector.h.
References TVector< T >::t, Vector< T >::x, Xabs, Vector< T >::y, and Vector< T >::z.
Quaternion<T> jbxl::operator+ | ( | const Quaternion< T > | a, | |
const Quaternion< T > | b | |||
) | [inline] |
Definition at line 125 of file Rotation.h.
References Quaternion< T >::c, Min, Quaternion< T >::s, Quaternion< T >::x, Quaternion< T >::y, and Quaternion< T >::z.
00126 { return Quaternion<T>(a.s+b.s, a.x+b.x, a.y+b.y, a.z+b.z, (T)0.0, Min(a.c, b.c)); }
Matrix<T> jbxl::operator+ | ( | const Matrix< T > | a, | |
const Matrix< T > | b | |||
) | [inline] |
Definition at line 401 of file Matrix++.h.
References Matrix< T >::getm(), isSameDimension(), Matrix< T >::mx, Matrix< T >::n, Matrix< T >::r, and Matrix< T >::sz.
00402 { 00403 Matrix<T> c; 00404 if (!isSameDimension(a, b)) return c; 00405 00406 c.getm(a.n, a.sz); 00407 if (c.mx!=NULL) for (int i=0; i<a.r; i++) c.mx[i] = a.mx[i] + b.mx[i]; 00408 return c; 00409 }
UVMap<T> jbxl::operator- | ( | const R | c, | |
UVMap< T > | a | |||
) | [inline] |
Definition at line 647 of file Vector.h.
References UVMap< T >::d, UVMap< T >::u, and UVMap< T >::v.
UVMap<T> jbxl::operator- | ( | const UVMap< T > | a, | |
R | c | |||
) | [inline] |
Definition at line 643 of file Vector.h.
References UVMap< T >::d, UVMap< T >::u, and UVMap< T >::v.
UVMap<T> jbxl::operator- | ( | const UVMap< T > | a, | |
const UVMap< T > | b | |||
) | [inline] |
Definition at line 639 of file Vector.h.
References UVMap< T >::d, UVMap< T >::u, and UVMap< T >::v.
UVMap<T> jbxl::operator- | ( | const UVMap< T > | a | ) | [inline] |
Definition at line 623 of file Vector.h.
References UVMap< T >::d, UVMap< T >::u, and UVMap< T >::v.
Vector<T> jbxl::operator- | ( | R | c, | |
const Vector< T > | a | |||
) | [inline] |
Definition at line 157 of file Vector.h.
References Vector< T >::c, Vector< T >::d, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Vector<T> jbxl::operator- | ( | const Vector< T > | a, | |
R | c | |||
) | [inline] |
Definition at line 153 of file Vector.h.
References Vector< T >::c, Vector< T >::d, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Vector<T> jbxl::operator- | ( | const Vector< T > | a, | |
const Vector< T > | b | |||
) | [inline] |
Definition at line 149 of file Vector.h.
References Vector< T >::c, Vector< T >::d, Min, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
00150 { return Vector<T>(a.x-b.x, a.y-b.y, a.z-b.z, 0.0, Min(a.c, b.c), a.d); }
Vector<T> jbxl::operator- | ( | const Vector< T > | a | ) | [inline] |
Definition at line 133 of file Vector.h.
References Vector< T >::c, Vector< T >::d, Vector< T >::n, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
TVector<T> jbxl::operator- | ( | const TVector< T > | a, | |
const R | d | |||
) | [inline] |
Definition at line 128 of file TVector.h.
References TVector< T >::t, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
TVector<T> jbxl::operator- | ( | const R | d, | |
const TVector< T > | a | |||
) | [inline] |
Definition at line 124 of file TVector.h.
References TVector< T >::t, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
TVector<T> jbxl::operator- | ( | const TVector< T > | a, | |
const TVector< T > | b | |||
) | [inline] |
Definition at line 111 of file TVector.h.
References TVector< T >::t, Vector< T >::x, Xabs, Vector< T >::y, and Vector< T >::z.
TVector<T> jbxl::operator- | ( | const TVector< T > | a | ) | [inline] |
Definition at line 86 of file TVector.h.
References Vector< T >::n, TVector< T >::t, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Quaternion<T> jbxl::operator- | ( | const Quaternion< T > | a, | |
const Quaternion< T > | b | |||
) | [inline] |
Definition at line 129 of file Rotation.h.
References Quaternion< T >::c, Min, Quaternion< T >::s, Quaternion< T >::x, Quaternion< T >::y, and Quaternion< T >::z.
00130 { return Quaternion<T>(a.s-b.s, a.x-b.x, a.y-b.y, a.z-b.z, (T)0.0, Min(a.c, b.c)); }
Quaternion<T> jbxl::operator- | ( | const Quaternion< T > | a | ) | [inline] |
Definition at line 121 of file Rotation.h.
References Quaternion< T >::c, Quaternion< T >::n, Quaternion< T >::s, Quaternion< T >::x, Quaternion< T >::y, and Quaternion< T >::z.
Matrix<T> jbxl::operator- | ( | const Matrix< T > | a, | |
const Matrix< T > | b | |||
) | [inline] |
Definition at line 413 of file Matrix++.h.
References Matrix< T >::getm(), isSameDimension(), Matrix< T >::mx, Matrix< T >::n, Matrix< T >::r, and Matrix< T >::sz.
00414 { 00415 Matrix<T> c; 00416 if (!isSameDimension(a, b)) return c; 00417 00418 c.getm(a.n, a.sz); 00419 if (c.mx!=NULL) for (int i=0; i<a.r; i++) c.mx[i] = a.mx[i] - b.mx[i]; 00420 return c; 00421 }
Matrix<T> jbxl::operator- | ( | const Matrix< T > | a | ) | [inline] |
Definition at line 392 of file Matrix++.h.
References Matrix< T >::mx, Matrix< T >::n, Matrix< T >::r, and Matrix< T >::sz.
UVMap<T> jbxl::operator/ | ( | const R | d, | |
const UVMap< T > | a | |||
) | [inline] |
Definition at line 663 of file Vector.h.
References UVMap< T >::d, UVMap< T >::u, and UVMap< T >::v.
UVMap<T> jbxl::operator/ | ( | const UVMap< T > | a, | |
const R | d | |||
) | [inline] |
Definition at line 659 of file Vector.h.
References UVMap< T >::d, UVMap< T >::u, and UVMap< T >::v.
Vector<T> jbxl::operator/ | ( | const R | d, | |
const Vector< T > | a | |||
) | [inline] |
Definition at line 173 of file Vector.h.
References Vector< T >::c, Vector< T >::d, Vector< T >::norm(), Vector< T >::x, Vector< T >::y, and Vector< T >::z.
00174 { 00175 Vector<T> v((T)d/a.x, (T)d/a.y, (T)d/a.z, 0.0, a.c, a.d); 00176 v.norm(); 00177 return v; 00178 }
Vector<T> jbxl::operator/ | ( | const Vector< T > | a, | |
const R | d | |||
) | [inline] |
Definition at line 169 of file Vector.h.
References Vector< T >::c, Vector< T >::d, Vector< T >::n, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
TVector<T> jbxl::operator/ | ( | const R | d, | |
const TVector< T > | a | |||
) | [inline] |
Definition at line 144 of file TVector.h.
References Vector< T >::norm2(), TVector< T >::t, Vector< T >::x, Xabs, Vector< T >::y, and Vector< T >::z.
00145 { return TVector<T>((T)d/a.x, (T)d/a.y, (T)d/a.z, Xabs((T)d)*a.t/a.norm2());}
TVector<T> jbxl::operator/ | ( | const TVector< T > | a, | |
const R | d | |||
) | [inline] |
Definition at line 140 of file TVector.h.
References TVector< T >::t, Vector< T >::x, Xabs, Vector< T >::y, and Vector< T >::z.
00141 { return TVector<T>(a.x/(T)d, a.y/(T)d, a.z/(T)d, a.t/Xabs((T)d));}
Quaternion<T> jbxl::operator/ | ( | const Quaternion< T > | a, | |
const R | d | |||
) | [inline] |
Definition at line 141 of file Rotation.h.
References Quaternion< T >::c, Quaternion< T >::n, Quaternion< T >::s, Quaternion< T >::x, Quaternion< T >::y, and Quaternion< T >::z.
Matrix<T> jbxl::operator/ | ( | const Matrix< T > | a, | |
const R | d | |||
) | [inline] |
Definition at line 446 of file Matrix++.h.
References Matrix< T >::mx, Matrix< T >::n, Matrix< T >::r, and Matrix< T >::sz.
bool jbxl::operator< | ( | const Vector< T > | v1, | |
const Vector< T > | v2 | |||
) | [inline] |
bool jbxl::operator== | ( | const UVMap< T > | a, | |
const UVMap< T > | b | |||
) | [inline] |
Definition at line 667 of file Vector.h.
References UVMap< T >::u, and UVMap< T >::v.
bool jbxl::operator== | ( | const Vector< T > | v1, | |
const Vector< T > | v2 | |||
) | [inline] |
Definition at line 191 of file Vector.h.
References Vector< T >::x, Vector< T >::y, and Vector< T >::z.
bool jbxl::operator== | ( | const TVector< T > | v1, | |
const TVector< T > | v2 | |||
) | [inline] |
Definition at line 148 of file TVector.h.
References TVector< T >::t, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
bool jbxl::operator== | ( | const Quaternion< T > | q1, | |
const Quaternion< T > | q2 | |||
) | [inline] |
Definition at line 107 of file Rotation.h.
References Quaternion< T >::s, Quaternion< T >::x, Quaternion< T >::y, and Quaternion< T >::z.
bool jbxl::operator== | ( | const Matrix< T > | v1, | |
const Matrix< T > | v2 | |||
) | [inline] |
Definition at line 455 of file Matrix++.h.
References isSameDimension(), Matrix< T >::mx, and Matrix< T >::r.
00456 { 00457 if (!isSameDimension(v1, v2)) return false; 00458 for (int i=0; i<v1.r; i++) if (v1.mx[i]!=v2.mx[i]) return false; 00459 return true; 00460 }
Vector<T> jbxl::operator^ | ( | const Vector< T > | a, | |
const Vector< T > | b | |||
) | [inline] |
Definition at line 182 of file Vector.h.
References Vector< T >::c, Min, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
00183 { return Vector<T>(a.y*b.z-a.z*b.y, a.z*b.x-a.x*b.z, a.x*b.y-a.y*b.x, 0.0, Min(a.c, b.c)); }
TVector<T> jbxl::operator^ | ( | const TVector< T > | a, | |
const TVector< T > | b | |||
) | [inline] |
Definition at line 167 of file TVector.h.
References Vector< T >::n, TVector< T >::t, Vector< T >::x, Xabs, Vector< T >::y, and Vector< T >::z.
Quaternion<T> jbxl::operator~ | ( | const Quaternion< T > | a | ) | [inline] |
Definition at line 116 of file Rotation.h.
References Quaternion< T >::c, Quaternion< T >::n, Quaternion< T >::s, Quaternion< T >::x, Quaternion< T >::y, and Quaternion< T >::z.
RBound<int> jbxl::out_around_MSGraph | ( | MSGraph< T > | vp, | |
int | x, | |||
int | y, | |||
int | mode = 8 | |||
) | [inline] |
template <typename t>=""> RBound<int> out_around_MSGraph(MSGraph<T> vp, int x, int y, int mode=8)
2Dグラフィックデータ構造体 vpの(x,y)にあるオブジェクトの周囲長を得る.
vp | 操作対象となる 2D グラフィックデータ構造体. | |
x,y | 情報を得たいオブジェクト内の左上縁(境界)の座標. または,左上方向のオブジェクト外の座標(この場合,上記の座標を探す) この座標の左横に情報を得たいオブジェクトの一部が在ってはいけない. | |
mode | モード.4: 4近傍探索.その他:8近傍探索. |
rb.xmax | オブジェクトの x座標の最大値. | |
rb.xmin | オブジェクトの x座標の最小値. | |
rb.ymax | オブジェクトの y座標の最大値. | |
rb.ymin | オブジェクトの y座標の最小値. | |
rb.zmax | 8近傍モード時の斜めの距離の回数. | |
rb.zmin | オブジェクトの周囲長.ただし,8近傍モードの場合,斜めの距離も1と数える. 周囲長を rb.zmin + rb.zmax*{sqrt(2.)-1} で計算する場合もある. |
Definition at line 305 of file Graph.h.
References MSGraph< T >::gp, Max, Min, RBound< T >::xmax, RBound< T >::xmin, MSGraph< T >::xs, RBound< T >::ymax, RBound< T >::ymin, MSGraph< T >::ys, MSGraph< T >::zero, RBound< T >::zmax, and RBound< T >::zmin.
00306 { 00307 int i, j, sp, cp, w, ll, ss; 00308 int xx, yy, vx, vy, ix; 00309 bool eflg=false; 00310 00311 int r8[8]={-1, 1, -1, -1, 1, -1, 1, 1}; 00312 int r4[8]={ 0, 1, -1, 0, 0, -1, 1, 0}; 00313 int* cc; 00314 00315 i = x; 00316 // オブジェクトを探す 00317 for (j=y; j<vp.ys-1; j++) { 00318 for (i=x; i<vp.xs-1; i++) { 00319 if (vp.gp[i+(j)*vp.xs]!=vp.zero) { 00320 eflg = true; 00321 break; 00322 } 00323 } 00324 if (eflg) break; 00325 } 00326 x = i; 00327 y = j; 00328 eflg = false; 00329 00330 RBound<int> rb(x, x, y, y); 00331 i = y*vp.xs + x; 00332 00333 sp = cp = i; 00334 ss = ll = 0; 00335 vx = 1; 00336 vy = 0; 00337 00338 if (mode==4) { 00339 ix = 4; 00340 cc = r4; 00341 } 00342 else { 00343 ix = 8; 00344 cc = r8; 00345 } 00346 00347 do { 00348 w = abs(vx)+abs(vy); 00349 xx = (vx*cc[0]+vy*cc[1])/w; 00350 yy = (vx*cc[2]+vy*cc[3])/w; 00351 for (j=1; j<=ix; j++) { 00352 if (vp.gp[cp+yy*vp.xs+xx]!=vp.zero) { 00353 vx = xx; 00354 vy = yy; 00355 cp = cp + yy*vp.xs + xx; 00356 xx = cp%vp.xs; 00357 yy = (cp-xx)/vp.xs; 00358 rb.xmax = Max(rb.xmax, xx); 00359 rb.ymax = Max(rb.ymax, yy); 00360 rb.xmin = Min(rb.xmin, xx); 00361 rb.ymin = Min(rb.ymin, yy); 00362 break; 00363 } 00364 else { 00365 if(sp==cp && xx==-1 && yy==vp.zero) { 00366 eflg = true; 00367 break; 00368 } 00369 w = abs(xx)+abs(yy); 00370 vx = (xx*cc[4]+yy*cc[5])/w; 00371 vy = (xx*cc[6]+yy*cc[7])/w; 00372 xx = vx; 00373 yy = vy; 00374 } 00375 } 00376 ll++; 00377 if (abs(vx)+abs(vy)==2) ss++; 00378 } while(!eflg); 00379 00380 if (mode==4) ss = 0; 00381 (rb.xmax)++; 00382 (rb.ymax)++; 00383 (rb.xmin)--; 00384 (rb.ymin)--; 00385 rb.zmax = ss; 00386 rb.zmin = ll; 00387 return rb; 00388 }
DllExport bool PatchupContour | ( | BREP_SHELL * | shell, | |
BREP_VERTEX ** | vert, | |||
bool | mode | |||
) |
bool jbxl::PatchupContour(BREP_SHELL* shell, BREP_VERTEX** vert, bool mode)
Shellに対して,vert[0]〜vert[2]の三角形Contourを補充する.
shell | シェルデータへのポインタ | |
[in,out] | vert | 頂点情報.補填された三角形の頂点情報が追加される. |
mode | true: 多重Edgeを認める. | |
mode | false: 多重Edgeを認めない. |
Definition at line 501 of file TriBrep.cpp.
References BREP_FACET, BREP_FACET::CloseData(), BREP_SOLID::contours, BREP_SOLID::counter, CreateContourByVertex(), DupEdgeNumber(), FastDeleteFacet(), BREP_VERTEX::forbidden_list, CVCounter::GetUsableCounter(), IsCollisionContours(), BREP_SHELL::solid, and CVCounter::StepIt().
Referenced by FillShortageWings_Near(), and FillShortageWings_Next().
00502 { 00503 if (vert[0]->forbidden_list!=NULL) { 00504 BREP_VERTEX_LIST::iterator vertex; 00505 vertex = std::find(vert[0]->forbidden_list->begin(), vert[0]->forbidden_list->end(), vert[2]); 00506 if (vertex!=vert[0]->forbidden_list->end()) return false; // 禁止Listの中に見つけた. 00507 } 00508 00509 BREP_SOLID* solid = shell->solid; 00510 CVCounter* counter = NULL; 00511 if (solid->counter!=NULL) counter = solid->counter->GetUsableCounter(); 00512 00513 BREP_FACET* facet = new BREP_FACET(shell); 00514 BREP_CONTOUR* contour = CreateContourByVertex(facet, vert); 00515 if (contour!=NULL) { 00516 if (DupEdgeNumber(contour)==0 || mode) { 00517 BREP_CONTOUR* collision; 00518 facet->CloseData(); 00519 if (!IsCollisionContours(solid, contour, &collision)) { 00520 solid->contours.push_back(contour); 00521 // PrintFacetAsciiSTL(contour); 00522 if (counter!=NULL) counter->StepIt(); 00523 return true; 00524 } 00525 else FastDeleteFacet(facet); 00526 } 00527 else FastDeleteFacet(facet); 00528 } 00529 else FastDeleteFacet(facet); 00530 00531 return false; 00532 }
bool jbxl::point_fat_object_morph | ( | MSGraph< T > | vp, | |
int | x, | |||
int | y, | |||
int | z, | |||
MSGraph< T > | xp, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> bool point_fat_object_morph(MSGraph<T> vp, int x, int y, int z, MSGraph<T> xp, int cc)
Definition at line 206 of file Morph.h.
References MSGraph< T >::gp, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
Referenced by fat_object_morph().
00207 { 00208 int i, j, k, cx, cy, cz; 00209 int xx, yy, zz, ax, ay, az; 00210 00211 for (k=0; k<xp.zs; k++) { 00212 zz = z + k - xp.zs/2; 00213 if (zz<0) zz = 0; 00214 if (zz>vp.zs-1) zz = vp.zs-1; 00215 az = vp.xs*vp.ys*zz; 00216 cz = xp.xs*xp.ys*k; 00217 for (j=0; j<xp.ys; j++) { 00218 yy = y + j - xp.ys/2; 00219 ay = az + vp.xs*yy; 00220 cy = cz + xp.xs*j; 00221 for (i=0; i<xp.xs; i++) { 00222 xx = x + i - xp.xs/2; 00223 ax = ay + xx; 00224 cx = cy + i; 00225 if (xp.gp[cx]>0) { 00226 if (xx>=0&&xx<vp.xs&&yy>=0&&yy<vp.ys) { 00227 if (vp.gp[ax]>=cc) return true; 00228 } 00229 } 00230 } 00231 } 00232 } 00233 00234 return false; 00235 }
bool jbxl::point_open_morph | ( | MSGraph< T > | vp, | |
int | x, | |||
int | y, | |||
int | z, | |||
MSGraph< T > | xp, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> bool point_open_morph(MSGraph<T> vp, int x, int y, int z, MSGraph<T> xp, int cc)
オープニング可能かどうかチェックする.
Definition at line 110 of file Morph.h.
References MSGraph< T >::gp, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
Referenced by opening_morph().
00111 { 00112 int i, j, k, cx, cy, cz; 00113 int xx, yy, zz, ax, ay, az; 00114 00115 for (k=0; k<xp.zs; k++) { 00116 zz = z + k - xp.zs/2; 00117 if (zz<0) zz = 0; 00118 if (zz>vp.zs-1) zz = vp.zs-1; 00119 az = vp.xs*vp.ys*zz; 00120 cz = xp.xs*xp.ys*k; 00121 for (j=0; j<xp.ys; j++) { 00122 yy = y + j - xp.ys/2; 00123 ay = az + vp.xs*yy; 00124 cy = cz + xp.xs*j; 00125 for (i=0; i<xp.xs; i++) { 00126 xx = x + i - xp.xs/2; 00127 ax = ay + xx; 00128 cx = cy + i; 00129 if (xp.gp[cx]>0) { 00130 if (!(xx>=0&&xx<vp.xs&&yy>=0&&yy<vp.ys)) return false; 00131 if (vp.gp[ax]<cc) return false; 00132 } 00133 } 00134 } 00135 } 00136 00137 return true; 00138 }
Quaternion<T> jbxl::PPPQuaternion | ( | Vector< T > | a, | |
Vector< T > | b, | |||
Vector< T > | c | |||
) | [inline] |
Definition at line 1490 of file Rotation.h.
References Vector< T >::c.
Quaternion<T> jbxl::PPVQuaternion | ( | Vector< T > | a, | |
Vector< T > | b, | |||
Vector< T > | c | |||
) | [inline] |
Definition at line 1514 of file Rotation.h.
References Vector< T >::c.
void jbxl::print_Matrix | ( | FILE * | fp, | |
Matrix< T > | a | |||
) | [inline] |
template <typename t>=""> void print_Matrix(FILE* fp, Matrix<T> a)
実数マトリックスの要素を標準出力に書き出す.デバッグ用.
fp | 出力先のファイルディスクリプタ | |
a | プリントするマトリックス |
Definition at line 246 of file Matrix++.h.
References Matrix< T >::mx, Matrix< T >::n, Matrix< T >::r, and Matrix< T >::sz.
DllExport void println_FacetAsciiSTL | ( | BREP_CONTOUR * | contour | ) |
void jbxl::println_FacetAsciiSTL(BREP_CONTOUR* contour)
contourの情報を STLのアスキー形式で表示する ReadSTLFileA()で読み込み可
Definition at line 395 of file STL.cpp.
References BREP_WING::next, BREP_CONTOUR::normal, BREP_VERTEX::point, PRINT_MESG, BREP_WING::vertex, BREP_CONTOUR::wing, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
00396 { 00397 BREP_WING* wing = contour->wing; 00398 00399 PRINT_MESG("facet normal %g %g %g\n", contour->normal.x, contour->normal.y, contour->normal.z); 00400 PRINT_MESG("outer loop\n"); 00401 for (int i=0; i<3; i++) { 00402 Vector<double> vect = wing->vertex->point; 00403 PRINT_MESG("vertex %g %g %g\n", vect.x, vect.y, vect.z); 00404 wing = wing->next; 00405 } 00406 PRINT_MESG("endloop\n"); 00407 PRINT_MESG("endfacet\n"); 00408 }
double jbxl::ProportionVector | ( | TVector< T > | v1, | |
TVector< T > | v2, | |||
T & | t | |||
) | [inline] |
template <typename t>=""> double ProportionVector(TVector<T> v1, TVector<T> v2, T& t)
ベクトルv1, v2が一直線上にあるかどうかをチェックする.
v1 = c*v2 の cを返す. tには誤差が入る.
Definition at line 65 of file TVector.h.
References Max, Vector< T >::n, TVector< T >::t, and Zero_Eps.
Referenced by CollisionTriContour2D(), IsAtLine(), and IsInTriangle().
00066 { 00067 double cc = 0.0; 00068 T tt = (T)(Max(v2.t, Zero_Eps)); 00069 if (v2.n>=tt) cc = (v1*v2)/(double)(v2.n*v2.n); 00070 00071 TVector<T> dif = v1 - cc*v2; 00072 T tolerance = (T)Max(dif.t, Zero_Eps); 00073 if (dif.n>=tolerance) { 00074 t = 0.0; 00075 return -HUGE_VALF; 00076 } 00077 t = (T)((v1.n*v2.t + v2.n*v1.t)/(v2.n*v2.n)); // 誤差 00078 return cc; 00079 }
Vector< T > Quaternion2ExtEulerXYZ | ( | Quaternion< T > | qut, | |
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1263 of file Rotation.h.
References Quaternion< T >::getRotMatrix().
01264 { 01265 Matrix<T> mtx = qut.getRotMatrix(); 01266 Vector<T> eul = RotMatrix2ExtEulerXYZ<T>(mtx, vct); 01267 mtx.free(); 01268 01269 return eul; 01270 }
Vector< T > Quaternion2ExtEulerXZY | ( | Quaternion< T > | qut, | |
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1285 of file Rotation.h.
References Matrix< T >::free(), Quaternion< T >::getRotMatrix(), and RotMatrix2ExtEulerXZY().
01286 { 01287 Matrix<T> mtx = qut.getRotMatrix(); 01288 Vector<T> eul = RotMatrix2ExtEulerXZY(mtx, vct); 01289 mtx.free(); 01290 01291 return eul; 01292 }
Vector< T > Quaternion2ExtEulerYXZ | ( | Quaternion< T > | qut, | |
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1307 of file Rotation.h.
References Matrix< T >::free(), Quaternion< T >::getRotMatrix(), and RotMatrix2ExtEulerYXZ().
01308 { 01309 Matrix<T> mtx = qut.getRotMatrix(); 01310 Vector<T> eul = RotMatrix2ExtEulerYXZ(mtx, vct); 01311 mtx.free(); 01312 01313 return eul; 01314 }
Vector< T > Quaternion2ExtEulerYZX | ( | Quaternion< T > | qut, | |
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1296 of file Rotation.h.
References Matrix< T >::free(), Quaternion< T >::getRotMatrix(), and RotMatrix2ExtEulerYZX().
01297 { 01298 Matrix<T> mtx = qut.getRotMatrix(); 01299 Vector<T> eul = RotMatrix2ExtEulerYZX(mtx, vct); 01300 mtx.free(); 01301 01302 return eul; 01303 }
Vector< T > Quaternion2ExtEulerZXY | ( | Quaternion< T > | qut, | |
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1318 of file Rotation.h.
References Matrix< T >::free(), Quaternion< T >::getRotMatrix(), and RotMatrix2ExtEulerZXY().
01319 { 01320 Matrix<T> mtx = qut.getRotMatrix(); 01321 Vector<T> eul = RotMatrix2ExtEulerZXY(mtx, vct); 01322 mtx.free(); 01323 01324 return eul; 01325 }
Vector< T > Quaternion2ExtEulerZYX | ( | Quaternion< T > | qut, | |
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1274 of file Rotation.h.
References Matrix< T >::free(), Quaternion< T >::getRotMatrix(), and RotMatrix2ExtEulerZYX().
01275 { 01276 Matrix<T> mtx = qut.getRotMatrix(); 01277 Vector<T> eul = RotMatrix2ExtEulerZYX(mtx, vct); 01278 mtx.free(); 01279 01280 return eul; 01281 }
CmnHead jbxl::readCmnHeadFile(const char* fn, CmnHead* chd, bool cnt=false)
データ種別を chdで指定して,グラフィックデータを読み込み,Common 形式に変換する.
サポートしているデータ形式は,
fn | 読み込むを行うファイル名. | |
[in,out] | chd | ファイルのヘッダ情報を入れる. |
cnt | 仮想カウンタを使用するか? |
JBXL_GRAPH_OPFILE_ERROR | xsize ファイルオープンエラー. | |
JBXL_GRAPH_MEMORY_ERROR | xsize メモリエラー. | |
JBXL_GRAPH_CANCEL | xsize キャンセル by ユーザ |
Definition at line 1202 of file Gio.cpp.
References CmnHead::bsize, CmnHead::buf, checkBit, CmnHead::depth, DICOM_DATA, file_size(), free_CmnHead(), GetUsableGlobalCounter(), MSGraph< T >::gp, CmnHead::grptr, HAS_LENDIAN, HAS_RZXY, HEADER_NONE, is_little_endian(), CVCounter::isCanceled(), JBXL_GRAPH_CANCEL, JBXL_GRAPH_HEADER_ERROR, JBXL_GRAPH_MEMORY_ERROR, JBXL_GRAPH_NOFILE_ERROR, JBXL_GRAPH_OPFILE_ERROR, JPEG_MONO_DATA, JPEG_RGB_DATA, CmnHead::kind, CmnHead::lsize, MOON_DATA, ntoh_ar, ntoh_st, PRINT_MESG, CVCounter::PutFill(), RAS_DATA, readDicomData(), readMoonData(), readRasData(), readUserSetData(), MSGraph< T >::RZxy, RZXY_RATE, CVCounter::SetMax(), CVCounter::SetPos(), CVCounter::StepIt(), UN_KNOWN_DATA, USERSET_DATA, MSGraph< T >::xs, CmnHead::xsize, MSGraph< T >::ys, CmnHead::ysize, MSGraph< T >::zs, and CmnHead::zsize.
Referenced by readGraphicSlices().
01203 { 01204 FILE* fp; 01205 int kind, fsz, hsz; 01206 bool no_ntoh = false; 01207 CmnHead hd; 01208 CVCounter* counter = NULL; 01209 01210 memset(&hd, 0, sizeof(CmnHead)); 01211 hd.kind = HEADER_NONE; 01212 hd.xsize = JBXL_GRAPH_HEADER_ERROR; 01213 01214 if (chd==NULL) return hd; 01215 01216 fsz = (int)file_size(fn); 01217 if (fsz==0) { 01218 hd.xsize = JBXL_GRAPH_NOFILE_ERROR; 01219 return hd; 01220 } 01221 01222 if ((fp=fopen(fn,"rb"))==NULL) { 01223 hd.xsize = JBXL_GRAPH_OPFILE_ERROR; 01224 return hd; 01225 } 01226 01227 // ファイルとCPUのエンディアンが同じ 01228 if (checkBit(chd->kind, HAS_LENDIAN) && is_little_endian()) { 01229 no_ntoh = true; 01230 } 01231 kind = chd->kind & 0x00ff; 01232 01233 // オペレータ指定のデータ形式.カウンタ未サポート 01234 if (kind == USERSET_DATA) { 01235 if (chd->zsize<=0) chd->zsize = 1; 01236 chd->lsize = chd->xsize*chd->ysize*chd->zsize*((chd->depth+7)/8); 01237 if (fsz==(int)(chd->bsize+chd->lsize)) { // ファイルサイズのチェック 01238 PRINT_MESG("readCmnHeadFile: オペレータ指定のデータ形式\n"); 01239 hd = readUserSetData(fp, chd, true); // カウンタ有効 01240 01241 // 24, 32bit 未対応 01242 if (hd.depth==16 && !no_ntoh) { 01243 sWord* wptr = (sWord*)hd.grptr; 01244 for (int i=0; i<hd.xsize*hd.ysize*hd.zsize; i++) { 01245 wptr[i] = ntohs(wptr[i]); 01246 } 01247 } 01248 } 01249 } 01250 01251 // DICOMファイル. 01252 else if (kind==DICOM_DATA) { 01253 MSGraph<sWord> vp = readDicomData(fp, fsz); 01254 if (vp.gp!=NULL) { 01255 PRINT_MESG("readCmnHeadFile: DICOMデータ形式\n"); 01256 hd.kind = DICOM_DATA; 01257 hd.xsize = vp.xs; 01258 hd.ysize = vp.ys; 01259 hd.zsize = vp.zs; 01260 hd.depth = 16; 01261 hd.bsize = sizeof(CTHead); 01262 hd.lsize = vp.xs*vp.ys*vp.zs*2; 01263 hd.buf = (uByte*)malloc(hd.bsize); 01264 hd.grptr = (uByte*)vp.gp; 01265 01266 CTHead* pcthd = (CTHead*)hd.buf; 01267 memset(pcthd, 0, hd.bsize); 01268 pcthd->xsize = (sWord)hd.xsize; 01269 pcthd->ysize = (sWord)hd.ysize; 01270 //pcthd->ctmin = 0; 01271 //pcthd->ctmax = 0; 01272 //pcthd->cutup = 0; 01273 //pcthd->cutdown = 0; 01274 //pcthd->cutleft = 0; 01275 //pcthd->cutright = 0; 01276 01277 if (vp.RZxy>0.0) { 01278 pcthd->anydata[0] = (sWord)(vp.RZxy*RZXY_RATE); 01279 pcthd->anydata[1] = RZXY_RATE; 01280 hd.kind |= HAS_RZXY; 01281 } 01282 01283 if (!no_ntoh) { 01284 sWord* wptr = (sWord*)hd.grptr; 01285 for (int i=0; i<hd.xsize*hd.ysize*hd.zsize; i++) { 01286 wptr[i] = ntohs(wptr[i]); 01287 } 01288 } 01289 } 01290 } 01291 01292 // Sun Raster 01293 else if (kind==RAS_DATA) { 01294 PRINT_MESG("readCmnHeadFile: Sun Rasterデータ形式\n"); 01295 hd = readRasData(fp); 01296 } 01297 01298 // Moon形式 16bit 01299 else if (kind==MOON_DATA) { 01300 PRINT_MESG("readCmnHeadFile: Moonデータ形式\n"); 01301 hd = readMoonData(fp, fsz, no_ntoh); 01302 } 01303 01304 #ifdef ENABLE_JPEGLIB 01305 // JPEG 01306 else if (kind==JPEG_RGB_DATA || kind==JPEG_MONO_DATA) { 01307 PRINT_MESG("readCmnHeadFile: JPEGデータ形式\n"); 01308 JPEGImage jpg = readJPEGData(fp); 01309 hd = JPEGImage2CmnHead(jpg); 01310 jpg.free(); 01311 } 01312 #endif 01313 01314 // TIFF 01315 /*else if (kind == TIFF_DATA) { 01316 01317 }*/ 01318 01319 // Common形式 01320 else if (kind!=UN_KNOWN_DATA) { 01321 // データ読み取りでは hd.lsize==0 のファイルサイズ無効(CT_RGN_SL)はまだサポートされていない 01322 PRINT_MESG("readCmnHeadFile: Commonデータ形式\n"); 01323 01324 hsz = sizeof(CmnHead); 01325 fseek(fp, 0, 0); 01326 fread(&hd, hsz, 1, fp); 01327 ntoh_st(&hd, 4); 01328 if (hd.zsize<=0) hd.zsize = 1; 01329 01330 // カウンタ 01331 if (hd.zsize>=10 && cnt) { 01332 counter = GetUsableGlobalCounter(); 01333 if (counter!=NULL) { 01334 //counter->SetTitle("Commonファイル読み込み中"); 01335 counter->SetMax(hd.zsize/10); 01336 counter->SetPos(0); 01337 } 01338 } 01339 01340 if (hd.bsize>0) hd.buf = (uByte*)malloc(hd.bsize); 01341 hd.grptr = (uByte*)malloc(hd.lsize); 01342 if ((hd.bsize>0&&hd.buf==NULL) || hd.grptr==NULL) { 01343 free_CmnHead(&hd); 01344 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 01345 hd.kind = HEADER_NONE; 01346 fclose(fp); 01347 return hd; 01348 } 01349 fseek(fp, hsz, 0); 01350 if (hd.bsize>0) { 01351 fread(hd.buf, hd.bsize, 1, fp); 01352 ntoh_ar((sWord*)hd.buf, hd.bsize); 01353 } 01354 01355 // ヘッダのみ 01356 if (hd.lsize==0) { 01357 if (counter!=NULL) counter->PutFill(); 01358 } 01359 else { 01360 // データ本体 01361 if (counter==NULL) { 01362 fread(hd.grptr, hd.lsize, 1, fp); 01363 } 01364 else { 01365 int psize = hd.xsize*hd.ysize*((hd.depth+7)/8); 01366 for (int i=0; i<hd.zsize; i++) { 01367 fread(hd.grptr+i*psize, psize, 1, fp); 01368 if (i%10==0) { 01369 counter->StepIt(); 01370 if (counter->isCanceled()) { // キャンセル 01371 //counter->Stop(); 01372 free_CmnHead(&hd); 01373 hd.xsize = JBXL_GRAPH_CANCEL; 01374 hd.kind = HEADER_NONE; 01375 fclose(fp); 01376 return hd; 01377 } 01378 } 01379 } 01380 } 01381 01382 // 24, 32bit 未対応 01383 if (hd.depth==16 && !no_ntoh) { 01384 sWord* wptr = (sWord*)hd.grptr; 01385 for (int i=0; i<hd.xsize*hd.ysize*hd.zsize; i++) { 01386 wptr[i] = ntohs(wptr[i]); 01387 } 01388 } 01389 01390 if (counter!=NULL) counter->PutFill(); 01391 } 01392 } 01393 01394 else { 01395 PRINT_MESG("readCmnHeadFile: 未知のデータ形式が指定された.(%04x, %04x)\n", chd->kind, (uWord)kind); 01396 } 01397 01398 fclose(fp); 01399 return hd; 01400 }
Definition at line 612 of file Gio.cpp.
References dicomHeader(), MSGraph< T >::gp, JBXL_GRAPH_HEADER_ERROR, MSGraph< T >::set(), and MSGraph< T >::xs.
Referenced by readCmnHeadFile(), readDicomFile(), and readXHeadFile().
00613 { 00614 int sz, dsize; 00615 int xsize, ysize, depth; 00616 double rzxy; 00617 MSGraph<sWord> vp; 00618 00619 memset(&vp, 0, sizeof(MSGraph<sWord>)); 00620 00621 sz = dicomHeader(fp, fsize, &dsize, &xsize, &ysize, &depth, &rzxy); 00622 if (sz<=0) { 00623 vp.xs = JBXL_GRAPH_HEADER_ERROR; 00624 return vp; 00625 } 00626 00627 if (dsize!=xsize*ysize*((depth+7)/8)) { 00628 vp.xs = JBXL_GRAPH_HEADER_ERROR; 00629 return vp; 00630 } 00631 00632 if ((depth+7)/8!=2) { 00633 vp.xs = JBXL_GRAPH_HEADER_ERROR; 00634 return vp; 00635 } 00636 00637 vp.set(xsize, ysize, 1, 0, 0, rzxy); 00638 00639 fseek(fp, sz, 0); 00640 fread(vp.gp, dsize, 1, fp); 00641 00642 return vp; 00643 }
MSGraph<sWord> jbxl::readDicomFile(const char* fn)
DICOM形式のデータを読み込む.
Definition at line 585 of file Gio.cpp.
References file_size(), JBXL_GRAPH_NOFILE_ERROR, JBXL_GRAPH_OPFILE_ERROR, readDicomData(), and MSGraph< T >::xs.
00586 { 00587 int fsize; 00588 FILE* fp; 00589 MSGraph<sWord> vp; 00590 00591 memset(&vp, 0, sizeof(MSGraph<sWord>)); 00592 00593 fsize = file_size(fn); 00594 if (fsize<=0) { 00595 vp.xs = JBXL_GRAPH_NOFILE_ERROR; 00596 return vp; 00597 } 00598 00599 if ((fp=fopen(fn,"r"))==NULL) { 00600 vp.xs = JBXL_GRAPH_OPFILE_ERROR; 00601 return vp; 00602 } 00603 00604 vp = readDicomData(fp, fsize); 00605 fclose(fp); 00606 00607 return vp; 00608 }
MSGraph<T> jbxl::readGraphicFile | ( | const char * | fname, | |
CmnHead * | chd = NULL , |
|||
bool | cnt = false | |||
) | [inline] |
template <typename t>=""> MSGraph<T> readGraphicFile(const char* fname, CmnHead* chd=NULL, bool cnt=false)
色々なグラフィックファイルを読み込んで,MSGraph<T>に格納.
サポートしているデータ形式は,
ただし,UN_KNOWN_DATAの場合は CmnHaedの hd->kind, hd->lsize, hd->gptr のみ有効.
fname | 読み込むを行うファイル名. | |
[in] | chd | USERSET_DATA指定の場合,ファイルのヘッダ情報を入れた CmnHead |
[out] | chd | CmnHeadにも格納したい場合は,そのアドレスを指定. |
cnt | カウンタ(プログレスバー)を使用するかどうか? |
エラーなら MSGraph.isNull()が真,または CmnHead.kind = HEADER_NONE となる.
またエラーの種類により MSGraph.stateが変化する.
JBXL_GRAPH_HEADER_ERROR | state ファイルのヘッダ読み取りエラー. | |
JBXL_GRAPH_MEMORY_ERROR | state メモリエラー. |
Definition at line 173 of file Gio.h.
References MSGraph< T >::base, CH2MG_NORMAL, CVCounter::DeleteChildCounter(), free_CmnHead(), GetUsableGlobalCounter(), MSGraph< T >::gp, CmnHead::grptr, HEADER_NONE, MSGraph< T >::init(), JBXL_GRAPH_HEADER_ERROR, CmnHead::kind, CVCounter::MakeChildCounter(), CVCounter::PutFill(), readXHeadFile(), CVCounter::SetMax(), CVCounter::SetTitle(), MSGraph< T >::state, UN_KNOWN_DATA, MSGraph< T >::xs, CmnHead::xsize, MSGraph< T >::ys, ZeroBase, and MSGraph< T >::zs.
00174 { 00175 MSGraph<T> vp; 00176 CmnHead hd; 00177 CVCounter* counter = NULL; 00178 00179 counter = GetUsableGlobalCounter(); 00180 if (counter!=NULL) { 00181 counter->SetMax(100); 00182 counter->MakeChildCounter(80); 00183 } 00184 00185 vp.init(); 00186 00187 hd = readXHeadFile(fname, chd, cnt); 00188 if (counter!=NULL) counter->DeleteChildCounter(); 00189 00190 // Error 00191 if (hd.kind==HEADER_NONE) { 00192 free_CmnHead(&hd); 00193 if (hd.xsize<0) vp.state = hd.xsize; 00194 else vp.state = JBXL_GRAPH_HEADER_ERROR; 00195 return vp; 00196 } 00197 00198 // Unknown Data 00199 int chk = hd.kind & 0x00ff; 00200 if (chk==UN_KNOWN_DATA) { 00201 if (chd!=NULL) *chd = hd; 00202 else free_CmnHead(&hd); 00203 vp.state = JBXL_GRAPH_HEADER_ERROR; 00204 return vp; 00205 } 00206 00207 if (counter!=NULL) counter->MakeChildCounter(80); 00208 00209 if (cnt) { 00210 CVCounter* counter = GetUsableGlobalCounter(); 00211 if (counter!=NULL) counter->SetTitle("画像データへ変換"); 00212 } 00213 00214 if (chd!=NULL) { 00215 *chd = hd; 00216 chd->grptr = chd->buf = NULL; 00217 } 00218 00219 vp = copyCmnHead2MSGraph<T>(hd, CH2MG_NORMAL, cnt); 00220 free_CmnHead(&hd); 00221 if (vp.gp==NULL) return vp; 00222 00223 if (ZeroBase!=0) { 00224 vp.base += ZeroBase; 00225 for (int i=0; i<vp.xs*vp.ys*vp.zs; i++) vp.gp[i] += (T)ZeroBase; 00226 } 00227 00228 if (counter!=NULL){ 00229 counter->DeleteChildCounter(); 00230 counter->PutFill(); 00231 } 00232 00233 return vp; 00234 }
MSGraph<T> jbxl::readGraphicSlices | ( | const char * | fmt, | |
int | fst, | |||
int | fnd, | |||
CmnHead * | chd = NULL , |
|||
bool | cnt = false | |||
) | [inline] |
template <typename t>=""> MSGraph<T> readGraphicSlices(const char* fmt, int fst, int fnd, CmnHead* chd=NULL, bool cnt=false)
色々なグラフィックファイルをスライスデータとして読み込んで,3D画像として MSGraph<T>に格納.また,chd!=NULL ならCommon(CmnHead)形式にも変換する.
Z方向の歪率をサポート(CmnHead, Moon形式のファイルのみ)
グローバルカウンタが使用可能.カウンタによるキャンセル機能を持つ.
readGraphicFile()と殆ど同じ手法を用いているので,その他は readGraphicFile()に準じる.
fmt | 読み込むを行うファイル名(dなどの入った書式). | |
fst | 最初に読み込むファイルの番号(ファイル名の中にその数字がなければならない) | |
fnd | 最後に読み込むファイルの番号(ファイル名の中にその数字がなければならない) | |
chd | CmnHeadにもデータを格納したい場合はそのアドレスを指定. または DICOM_DATA, USERSET_DATA指定時のヘッダ情報を格納する. | |
cnt | 仮想カウンタを使用するか? |
vp = readGraphicSlices("i%02d", 0, 10); // i00 〜 i10 までの11枚の画像データを読み込んで,vpに格納.
Definition at line 262 of file Gio.h.
References MSGraph< T >::base, CmnHead::buf, CH2MG_NOPARM, checkBit, MSGraph< T >::color, copyMSGraph2CmnHead(), CT_3DM, CT_DATA, DEBUG_MESG, DEBUG_MODE, CmnHead::depth, DICOM_DATA, MSGraph< T >::free(), free_CmnHead(), freeNull(), getinfo_CmnHead(), MSGraph< T >::getm(), GetUsableGlobalCounter(), MSGraph< T >::gp, GRAPH_COLOR_MONO, GRAPH_COLOR_MONO16, HAS_BASE, HAS_RBOUND, HAS_RZXY, HEADER_NONE, MSGraph< T >::init(), CVCounter::isCanceled(), MSGraph< T >::isNull(), JBXL_GRAPH_CANCEL, JBXL_GRAPH_HEADER_ERROR, JBXL_GRAPH_MEMORY_ERROR, CmnHead::kind, MSGraph< T >::max, Max, Min, MSGraph< T >::min, numbering_name(), PRINT_MESG, CVCounter::PutFill(), MSGraph< T >::rbound, readCmnHeadFile(), readXHead(), MSGraph< T >::RZxy, RZXY_RATE, RBound< T >::set(), CVCounter::SetMax(), CVCounter::SetPos(), CVCounter::SetTitle(), Sign, MSGraph< T >::state, CVCounter::StepIt(), UN_KNOWN_DATA, USERSET_DATA, Xabs, RBound< T >::xmax, RBound< T >::xmin, MSGraph< T >::xs, CmnHead::xsize, RBound< T >::ymax, RBound< T >::ymin, MSGraph< T >::ys, CmnHead::ysize, ZeroBase, RBound< T >::zmax, RBound< T >::zmin, MSGraph< T >::zs, and CmnHead::zsize.
00263 { 00264 int i, k, l, m, chk, kind; 00265 int xsize, ysize, zsize, nsize, psize; // zsize: 1枚の画像のZサイズ. 00266 // nsize: 出来上がりの 3D画像のZサイズ 00267 char* fr_name; 00268 CmnHead dhd, hd; 00269 MSGraph<T> vp, gd; 00270 00271 if (chd!=NULL) { 00272 DEBUG_MESG("readGraphicSlices: Called with kind = 0x%04x\n", chd->kind); 00273 } 00274 else { 00275 DEBUG_MESG("readGraphicSlices: Called with NULL Header\n"); 00276 } 00277 00278 gd.init(); 00279 vp.init(); 00280 00281 // 1枚目(ヘッダ情報)の読み出し 00282 fr_name = numbering_name(fmt, fst); 00283 dhd = readXHead(fr_name, chd); 00284 freeNull(fr_name); 00285 00286 chk = dhd.kind & 0x00ff; 00287 if (dhd.kind==HEADER_NONE || chk==UN_KNOWN_DATA) { 00288 DEBUG_MODE PRINT_MESG("readGraphicSlices: ヘッダ読み込みエラー: kind = %d\n", dhd.kind); 00289 free_CmnHead(&dhd); 00290 vp.state = JBXL_GRAPH_HEADER_ERROR; 00291 vp.zs = fst; 00292 return vp; 00293 } 00294 kind = dhd.kind; 00295 xsize = dhd.xsize; 00296 ysize = dhd.ysize; 00297 zsize = Max(dhd.zsize, 1); 00298 nsize = zsize*(Xabs(fnd - fst) + 1); 00299 psize = xsize*ysize*zsize; 00300 if (dhd.depth==16) gd.color = GRAPH_COLOR_MONO16; 00301 else gd.color = GRAPH_COLOR_MONO; 00302 00303 // カウンタ 00304 CVCounter* counter = NULL; 00305 if (nsize>=10 && cnt) { 00306 counter = GetUsableGlobalCounter(); 00307 if (counter!=NULL) { 00308 //counter->SetTitle("マルチファイル読み込み中"); 00309 counter->SetMax(nsize/10); 00310 counter->SetPos(1); 00311 } 00312 } 00313 00314 // Z軸の歪, ベース,rbound の設定 00315 if (dhd.buf!=NULL && (chk==CT_DATA || chk==CT_3DM || chk==DICOM_DATA)) { 00316 sWord* rz = (sWord*)dhd.buf; 00317 if (rz[9]==RZXY_RATE || checkBit(dhd.kind, HAS_RZXY)) { 00318 double rzm = rz[8]/(double)rz[9]; 00319 if (rzm<5.0 && rzm>0.) gd.RZxy = rzm; 00320 } 00321 00322 if (rz[10]!=0 && checkBit(dhd.kind, HAS_BASE)) { 00323 gd.base = (T)rz[10]; 00324 } 00325 00326 if (checkBit(dhd.kind, HAS_RBOUND)) { 00327 gd.rbound.xmin = rz[6]; 00328 gd.rbound.xmax = rz[7]; 00329 gd.rbound.ymin = rz[4]; 00330 gd.rbound.ymax = rz[5]; 00331 gd.rbound.zmin = rz[2]; 00332 gd.rbound.zmax = rz[3]; 00333 } 00334 } 00335 free_CmnHead(&dhd); 00336 00337 dhd.kind = kind; 00338 if (chd!=NULL) dhd.kind |= chd->kind & 0xff00; // オプション 00339 *chd = getinfo_CmnHead(dhd); 00340 00341 // データ読み込み(Z軸方向) 1枚目から 00342 gd.getm(xsize, ysize, nsize); 00343 if (gd.isNull()) return gd; 00344 00345 l = 0; 00346 k = fst; 00347 m = Sign(fnd - fst); 00348 while(k != fnd+m){ 00349 fr_name = numbering_name(fmt, k); 00350 hd = readCmnHeadFile(fr_name, &dhd, false); // カウンタ無効 00351 free(fr_name); 00352 00353 chk = hd.kind & 0x00ff; 00354 if (hd.kind==HEADER_NONE || chk==UN_KNOWN_DATA) { 00355 DEBUG_MESG("readGraphicSlices: データ読み込みエラー: n = %d, kind = %d\n", k, hd.kind); 00356 free_CmnHead(&hd); 00357 if (l==0) { // 1枚目でエラー 00358 gd.free(); 00359 vp.state = JBXL_GRAPH_HEADER_ERROR; 00360 vp.zs = k; 00361 return vp; 00362 } 00363 else { // 途中までは読み込み完了 00364 gd.state = l; 00365 gd.zs = l*zsize; 00366 break; 00367 } 00368 } 00369 00370 vp = copyCmnHead2MSGraph<T>(hd, CH2MG_NOPARM, false); // カウンタ無効 00371 if (vp.isNull()) { 00372 free_CmnHead(&hd); 00373 gd.free(); 00374 vp.free(); 00375 vp.state = JBXL_GRAPH_MEMORY_ERROR; 00376 vp.zs = k; 00377 return vp; 00378 } 00379 00380 // gd へコピー 00381 for (i=0; i<psize; i++) gd.gp[i + psize*l] = vp.gp[i] + ZeroBase; 00382 if (l==0) { 00383 gd.min = vp.min; 00384 gd.max = vp.max; 00385 } 00386 else { 00387 gd.min = Min(gd.min, vp.min); 00388 gd.max = Max(gd.max, vp.max); 00389 } 00390 00391 // 後始末 00392 free_CmnHead(&hd); 00393 vp.free(); 00394 k += m; 00395 l++; 00396 00397 // カウンタ 00398 if (counter!=NULL && l%10==0) { 00399 counter->StepIt(); 00400 if (counter->isCanceled()) { // キャンセル 00401 gd.free(); 00402 vp.state = JBXL_GRAPH_CANCEL; 00403 vp.zs = k; 00404 return vp; 00405 } 00406 } 00407 } 00408 gd.state = l; 00409 gd.base += ZeroBase; 00410 00411 if (!checkBit(kind, HAS_RBOUND)) gd.rbound.set(0, gd.xs-1, 0, gd.ys-1, 0, gd.zs-1); 00412 if (chd!=NULL) { 00413 if ((chd->kind&0x00ff)==USERSET_DATA) { 00414 CVCounter* counter = GetUsableGlobalCounter(); 00415 if (counter!=NULL) counter->SetTitle("Converting Data"); 00416 *chd = copyMSGraph2CmnHead(gd); 00417 } 00418 } 00419 if (counter!=NULL) { 00420 counter->PutFill(); 00421 //counter->Stop(); 00422 } 00423 00424 return gd; 00425 }
CmnHead readMoonData | ( | FILE * | fp, | |
unsigned int | fsz = 0 , |
|||
bool | no_ntoh = false | |||
) |
CmnHead jbxl::readMoonData(FILE* fp, unsigned int fsz, bool no_ntoh)
MOON_DATA形式(16bit)のグラフィックファイルを読み込む.
fp | 読み込むを行うファイルのファイル識別子. | |
fsz | ファイルのサイズ(チェックに使用, 0以下ならチェックしない) | |
no_ntoh | trueの場合,エンディアンの変換を行わない. |
-2 | xsize メモリエラー. |
Definition at line 358 of file Gio.cpp.
References CmnHead::bsize, CmnHead::buf, CmnHead::depth, freeNull(), CmnHead::grptr, HEADER_NONE, JBXL_GRAPH_MEMORY_ERROR, CmnHead::kind, CmnHead::lsize, MOON_DATA, ntoh_st, CmnHead::xsize, CmnHead::ysize, and CmnHead::zsize.
Referenced by readCmnHeadFile(), readMoonFile(), and readXHeadFile().
00359 { 00360 int i; 00361 CTHead chd; 00362 CmnHead hd; 00363 00364 hd.kind = HEADER_NONE; 00365 hd.bsize = 64; // Moon形式のヘッダサイズ 00366 00367 // ヘッダ読み込み 00368 fseek(fp, 0, 0); 00369 fread((void*)&chd, hd.bsize, 1, fp); 00370 ntoh_st(&chd, 2); 00371 00372 hd.xsize = chd.xsize - chd.cutleft - chd.cutright; 00373 hd.ysize = chd.ysize - chd.cutup - chd.cutdown; 00374 hd.zsize = 1; 00375 hd.depth = 16; 00376 hd.lsize = hd.xsize*hd.ysize*(hd.depth/8); 00377 hd.buf = NULL; 00378 hd.grptr = NULL; 00379 if (fsz>0 && fsz!=hd.bsize+hd.lsize) return hd; 00380 00381 hd.buf = (uByte*)malloc(hd.bsize); 00382 if (hd.buf==NULL) { 00383 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00384 return hd; 00385 } 00386 hd.kind = MOON_DATA; 00387 memcpy(hd.buf, &chd, hd.bsize); 00388 00389 hd.grptr = (uByte*)malloc(hd.lsize); 00390 if (hd.grptr==NULL) { 00391 freeNull(hd.buf); 00392 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00393 hd.kind = HEADER_NONE; 00394 return hd; 00395 } 00396 00397 fseek(fp, hd.bsize, 0); 00398 fread(hd.grptr, hd.lsize, 1, fp); 00399 00400 if (!no_ntoh) { 00401 sWord* wptr = (sWord*)hd.grptr; 00402 for (i=0; i<hd.xsize*hd.ysize; i++) wptr[i] = ntohs(wptr[i]); 00403 } 00404 return hd; 00405 }
CmnHead readMoonFile | ( | const char * | fn, | |
bool | no_ntoh = false | |||
) |
CmnHead jbxl::readMoonFile(const char* fn, bool no_ntoh)
MOON_DATA形式(16bit)のグラフィックファイルを読み込む.
fn | 読み込むを行うファイル名. | |
no_ntoh | trueの場合,エンディアンの変換を行わない. |
JBXL_GRAPH_MEMORY_ERROR | xsize メモリエラー. |
Definition at line 320 of file Gio.cpp.
References file_size(), HEADER_NONE, JBXL_GRAPH_NOFILE_ERROR, JBXL_GRAPH_OPFILE_ERROR, CmnHead::kind, readMoonData(), and CmnHead::xsize.
00321 { 00322 CmnHead hd; 00323 FILE* fp; 00324 unsigned int fsz; 00325 00326 memset(&hd, 0, sizeof(CmnHead)); 00327 hd.kind = HEADER_NONE; 00328 00329 fsz = file_size(fn); 00330 if (fsz==0) { 00331 hd.xsize = JBXL_GRAPH_NOFILE_ERROR; 00332 return hd; 00333 } 00334 if ((fp=fopen(fn,"rb"))==NULL) { 00335 hd.xsize = JBXL_GRAPH_OPFILE_ERROR; 00336 return hd; 00337 } 00338 00339 hd = readMoonData(fp, fsz, no_ntoh); 00340 return hd; 00341 }
CmnHead readRasData | ( | FILE * | fp | ) |
CmnHead jbxl::readRasData(FILE* fp)
SUN RASTER形式のグラフィックファイルを読み込む.
fp | 読み込むを行うファイルのファイル識別子. |
JBXL_GRAPH_MEMORY_ERROR | xsize メモリエラー. |
Definition at line 32 of file Gio.cpp.
References CmnHead::bsize, CmnHead::buf, CmnHead::depth, freeNull(), CmnHead::grptr, HEADER_NONE, JBXL_GRAPH_MEMORY_ERROR, CmnHead::kind, CmnHead::lsize, ntoh_st, RAS_DATA, RasHead::ras_depth, RasHead::ras_height, RasHead::ras_width, CmnHead::xsize, CmnHead::ysize, and CmnHead::zsize.
Referenced by readCmnHeadFile(), readRasFile(), and readXHeadFile().
00033 { 00034 RasHead rhd; 00035 CmnHead hd; 00036 int i, linebyte, databyte; 00037 uByte null[2], *buf; 00038 sWord* wptr; 00039 00040 hd.kind = RAS_DATA; 00041 hd.bsize = 32; 00042 hd.buf = NULL; 00043 hd.grptr = NULL; 00044 00045 fseek(fp, 0, 0); 00046 fread(&rhd, hd.bsize, 1, fp); 00047 ntoh_st(&rhd, 4); 00048 00049 hd.xsize = rhd.ras_width; 00050 hd.ysize = rhd.ras_height; 00051 hd.zsize = 1; 00052 hd.depth = rhd.ras_depth; 00053 hd.lsize = hd.xsize*hd.ysize*((hd.depth+7)/8); 00054 hd.buf = (uByte*)malloc(hd.bsize); 00055 if (hd.buf==NULL) { 00056 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00057 hd.kind = HEADER_NONE; 00058 return hd; 00059 } 00060 memcpy(hd.buf, (uByte*)&rhd, hd.bsize); 00061 00062 hd.grptr = (uByte*)malloc(hd.lsize); 00063 if (hd.grptr==NULL) { 00064 freeNull(hd.buf); 00065 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00066 hd.kind = HEADER_NONE; 00067 return hd; 00068 } 00069 buf = (uByte*)hd.grptr; 00070 00071 fseek(fp, rhd.ras_maplength, 1); 00072 00073 databyte = hd.xsize*((hd.depth+7)/8); 00074 linebyte = rhd.ras_length/hd.ysize; 00075 00076 if (databyte==linebyte) { 00077 fread(buf, hd.lsize, 1, fp); 00078 } 00079 else { 00080 for (i=0; i<hd.ysize; i++) { 00081 fread(buf, databyte, 1, fp); 00082 fread(null, linebyte-databyte, 1, fp); 00083 buf += databyte; 00084 } 00085 } 00086 00087 if (hd.depth==16){ 00088 wptr = (sWord*)hd.grptr; 00089 for(i=0; i<hd.xsize*hd.ysize; i++) wptr[i] = ntohs(wptr[i]); 00090 } 00091 00092 return hd; 00093 }
MSGraph<T> jbxl::readRasFile | ( | const char * | fname | ) | [inline] |
template <typename t>=""> MSGraph<T> readRasFile(const char *fname)
Definition at line 587 of file Gio.h.
References CH2MG_NORMAL, MSGraph< T >::init(), and readRasData().
00588 { 00589 MSGraph<T> vp; 00590 CmnHead hd; 00591 FILE* fp; 00592 00593 vp.init(); 00594 fp = fopen(fname, "rb"); 00595 if (fp==NULL) return vp; 00596 00597 hd = readRasData(fp); 00598 fclose(fp); 00599 00600 vp = copyCmnHead2MSGraph<T>(hd, CH2MG_NORMAL); 00601 return vp; 00602 }
DllExport STLData * ReadSTLFile | ( | char * | fname, | |
long int * | fno | |||
) |
STLData* jbxl::ReadSTLFile(char* fname, unsigned int* fno)
STLファイルを読み込むラッパー関数.アスキー,バイナリを自動判別.
読み込んだファセットの数(fno)を返す.
Definition at line 25 of file STL.cpp.
References DEBUG_MODE, PRINT_MESG, ReadSTLFileA(), and ReadSTLFileB().
00026 { 00027 FILE* fp; 00028 struct stat stbuf; 00029 STLData* stldata; 00030 unsigned int temp; 00031 00032 fp = fopen(fname, "rb"); 00033 if (fp==NULL) return NULL; 00034 fseek(fp, 80, SEEK_SET); 00035 fread(&temp, 4, 1, fp); 00036 fclose(fp); 00037 *fno = (long int)temp; 00038 00039 stat(fname, &stbuf); 00040 if (stbuf.st_size == (*fno)*50+84) { // ファイルサイズのチェック 00041 stldata = ReadSTLFileB(fname, fno); // バイナリファイル 00042 } 00043 else { 00044 stldata = ReadSTLFileA(fname, fno); // アスキーファイル 00045 } 00046 00047 if (stldata==NULL) { 00048 if (*fno!=0) { 00049 DEBUG_MODE PRINT_MESG("ReadSTLFile: メモリの確保に失敗.\n"); 00050 } 00051 else { 00052 DEBUG_MODE PRINT_MESG("ReadSTLFile: データの読み込みに失敗.\n"); 00053 } 00054 } 00055 else { 00056 DEBUG_MODE PRINT_MESG("ReadSTLFile: file name = %s\n", fname); 00057 DEBUG_MODE PRINT_MESG("ReadSTLFile: read facet No. = %d\n", *fno); 00058 } 00059 00060 return stldata; 00061 }
DllExport STLData * ReadSTLFileA | ( | char * | fname, | |
long int * | fno | |||
) |
STLData* jbxl::ReadSTLFileA(char* fname, long int* fno)
アスキー形式の STLファイルを読み込み,読み込んだファセットの数を返す.
ファイル中の facet, vertex 以外は無視.
Definition at line 112 of file STL.cpp.
References CHAR_TAB, LBUF, and strncasecmp.
Referenced by ReadSTLFile().
00113 { 00114 FILE* fp; 00115 STLData* stldata = NULL; 00116 float vect[3]; 00117 char buffer[LBUF], dummy[LBUF], *pbuf; 00118 int vno=0; 00119 00120 // ファイルをオープンしてデータ数を数える. 00121 *fno = 0; 00122 fp = fopen(fname, "r"); 00123 if (fp==NULL) return NULL; 00124 00125 fgets(buffer, LBUF, fp); 00126 while (!feof(fp)) { 00127 pbuf = buffer; 00128 while(*pbuf==' '||*pbuf==CHAR_TAB) pbuf++; 00129 00130 if (!strncasecmp(pbuf, "facet ", 6)) (*fno)++; 00131 if (!strncasecmp(pbuf, "vertex ", 7)) vno++; 00132 fgets(buffer, LBUF, fp); 00133 } 00134 fclose(fp); 00135 00136 // メモリの確保 00137 if (vno!=0 && vno==(*fno)*3) { 00138 stldata = (STLData*)malloc(sizeof(STLData)*(*fno)); 00139 } 00140 if (stldata==NULL) { 00141 *fno = 0; 00142 return NULL; 00143 } 00144 00145 // もう一度ファイルをオープンして,データを読み込む. 00146 int i=0, j=0; 00147 fp = fopen(fname, "r"); 00148 if (fp==NULL) return NULL; 00149 00150 fgets(buffer, LBUF, fp); 00151 while (!feof(fp)) { 00152 pbuf = buffer; 00153 while(*pbuf==' '||*pbuf==CHAR_TAB) pbuf++; 00154 00155 if (!strncasecmp(pbuf, "facet ", 6)) { // 法線ベクトル 00156 sscanf(buffer, "%s %s %f %f %f", dummy, dummy, &vect[0], &vect[1], &vect[2]); 00157 for (int k=0; k<3; k++) stldata[i].vect[k] = vect[k]; 00158 j = 3; 00159 } 00160 else if (!strncasecmp(pbuf, "vertex ", 7) && j>=3 && j<12) {// 座標 00161 sscanf(buffer, "%s %f %f %f", dummy, &vect[0], &vect[1], &vect[2]); 00162 for (int k=0; k<3; k++) stldata[i].vect[j+k] = vect[k]; 00163 j += 3; 00164 if (j==12) i++; 00165 } 00166 fgets(buffer, LBUF, fp); 00167 } 00168 fclose(fp); 00169 00170 return stldata; 00171 }
DllExport STLData * ReadSTLFileB | ( | char * | fname, | |
long int * | fno | |||
) |
STLData* jbxl::ReadSTLFileB(char* fname, long int* fno)
バイナリ形式の STLファイルを読み込み,読み込んだファセットの数を返す.
Definition at line 180 of file STL.cpp.
References STLData::vect.
Referenced by ReadSTLFile().
00181 { 00182 FILE* fp; 00183 char message[81]; // STLのファイルメッセージ 00184 tmpSTLData* tmp_stldata; 00185 STLData* stldata; 00186 STLData* exdata; 00187 00188 fp = fopen(fname, "rb"); 00189 if (fp==NULL) return NULL; 00190 fread(message, 80, 1, fp); 00191 message[80] = '\0'; // STLのファイルメッセージ(message[])80Byteは未使用 00192 00193 fread(fno, 4, 1, fp); 00194 tmp_stldata = (tmpSTLData*)malloc(sizeof(tmpSTLData)*(*fno)); 00195 if (tmp_stldata==NULL) return NULL; 00196 fread(tmp_stldata, sizeof(tmpSTLData), *fno, fp); 00197 fclose(fp); 00198 00199 stldata = (STLData*)malloc(sizeof(STLData)*(*fno)); 00200 if (stldata==NULL) { 00201 free(tmp_stldata); 00202 return NULL; 00203 } 00204 00205 for (int i=0; i<(*fno); i++) { 00206 exdata = (STLData*)(&tmp_stldata[i]); // アドレスの読み替え(50Byteの構造体を作れないため) 00207 for (int j=0; j<12; j++) { 00208 stldata[i].vect[j] = exdata->vect[j]; // データの移動 00209 } 00210 } 00211 00212 free(tmp_stldata); 00213 return stldata; 00214 }
TGAImage readTGAData | ( | FILE * | fp | ) |
TGAImage jbxl::readTGAData(FILE* fp)
TGAファイルを読み込んで,TGAImage構造体へデータを格納する.
fp | 読み込むファイルの記述子 |
JBXL_GRAPH_OPFILE_ERROR | state: ファイルオープンエラー | |
JBXL_GRAPH_HEADER_ERROR | state: 不正ファイル(TGAファイルでない?) | |
JBXL_GRAPH_MEMORY_ERROR | state: メモリエラー |
Definition at line 163 of file TgaTool.cpp.
References TGAImage::free(), JBXL_GRAPH_IVDARG_ERROR, PRINT_MESG, and TGAImage::state.
Referenced by readTGAFile().
00164 { 00165 TGAImage tga; 00166 00167 fseek(fp, 0, 0); 00168 tga.free(); 00169 00170 /**********************************************************************/ 00171 PRINT_MESG("**********************************************\n"); 00172 PRINT_MESG("ERROR: jbxl::readTGAData() is not implemeted!!\n"); 00173 PRINT_MESG("**********************************************\n"); 00174 tga.state = JBXL_GRAPH_IVDARG_ERROR; 00175 /**********************************************************************/ 00176 00177 return tga; 00178 }
TGAImage readTGAFile | ( | const char * | fname | ) |
TGAImage jbxl::readTGAFile(const char* fname)
TGAファイルを読み込んで,TGAImage構造体へデータを格納する.
fname | 読み込むファイル名 |
JBXL_GRAPH_OPFILE_ERROR | state: ファイルオープンエラー | |
JBXL_GRAPH_HEADER_ERROR | state: 不正ファイル(TGAファイルでない?) | |
JBXL_GRAPH_MEMORY_ERROR | state: メモリエラー |
Definition at line 132 of file TgaTool.cpp.
References TGAImage::gp, JBXL_GRAPH_OPFILE_ERROR, readTGAData(), and TGAImage::state.
00133 { 00134 TGAImage tga; 00135 FILE* fp; 00136 00137 fp = fopen(fname, "rb"); 00138 if (fp==NULL) { 00139 tga.gp = NULL; 00140 tga.state = JBXL_GRAPH_OPFILE_ERROR; 00141 return tga; 00142 } 00143 00144 tga = readTGAData(fp); 00145 fclose(fp); 00146 00147 return tga; 00148 }
CmnHead jbxl::readUserSetData(FILE* fp, CmnHead* chd, bool cnt=false);
オペレータ指定のヘッダ形式にしたがってグラフィックファイルを読み込む.
ヘッダ形式のチェック(ファイルサイズの整合性など)は行わないので,それらは呼び出し側の責任となる.
リトルエンディアン対応.カウンタ制御の場合は遅くなる.
fp | 読み込むを行うファイルのファイル識別子. | |
[in] | chd | 読み込むファイルのヘッダ情報を入れた CmnHead. カウンタを使用する場合: kind, xsize, ysize, zsize, bsize 必須. カウンタを使用しない場合:kind, bsize, lseize 必須. |
cnt | 読み込み状況カウンタを使用するかどうか.true: 使用する. |
JBXL_GRAPH_HEADER_ERROR | xsize オペレータ指定のヘッダがない. | |
JBXL_GRAPH_MEMORY_ERROR | xsize メモリエラー. | |
JBXL_GRAPH_CANCEL | xsize キャンセル. |
Definition at line 222 of file Gio.cpp.
References CmnHead::bsize, CmnHead::buf, checkBit, CmnHead::depth, free_CmnHead(), freeNull(), GetUsableGlobalCounter(), CmnHead::grptr, HAS_LENDIAN, HEADER_NONE, init_CmnHead(), is_little_endian(), CVCounter::isCanceled(), JBXL_GRAPH_CANCEL, JBXL_GRAPH_MEMORY_ERROR, CmnHead::kind, CmnHead::lsize, CVCounter::PutFill(), CVCounter::SetMax(), CVCounter::SetPos(), CVCounter::StepIt(), USERSET_DATA, CmnHead::xsize, CmnHead::ysize, and CmnHead::zsize.
Referenced by readCmnHeadFile(), and readXHeadFile().
00223 { 00224 CmnHead hd; 00225 init_CmnHead(&hd); 00226 CVCounter* counter = NULL; 00227 00228 if (chd==NULL) { 00229 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00230 return hd; 00231 } 00232 else if ((chd->kind&0x0ff)!=USERSET_DATA) { 00233 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00234 return hd; 00235 } 00236 hd = *chd; 00237 00238 // ヘッダ読み込み 00239 fseek(fp, 0, 0); 00240 hd.buf = (uByte*)malloc(hd.bsize); 00241 if (hd.buf==NULL) { 00242 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00243 hd.kind = HEADER_NONE; 00244 return hd; 00245 } 00246 fread((void*)hd.buf, hd.bsize, 1, fp); 00247 00248 // カウンタ 00249 if (hd.zsize>=10 && cnt) { 00250 counter = GetUsableGlobalCounter(); 00251 if (counter!=NULL) { 00252 //counter->SetTitle("ユーザ指定ファイル読み込み中"); 00253 counter->SetMax((hd.zsize+1)/10); 00254 counter->SetPos(1); 00255 } 00256 } 00257 00258 hd.grptr = (uByte*)malloc(hd.lsize); 00259 if (hd.grptr==NULL) { 00260 freeNull(hd.buf); 00261 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00262 hd.kind = HEADER_NONE; 00263 return hd; 00264 } 00265 00266 fseek(fp, hd.bsize, 0); 00267 00268 if (counter==NULL) { 00269 fread(hd.grptr, hd.lsize, 1, fp); 00270 } 00271 else { 00272 int psize = hd.xsize*hd.ysize*((hd.depth+7)/8); 00273 for (int i=0; i<hd.zsize; i++) { 00274 fread(hd.grptr+i*psize, psize, 1, fp); 00275 if (i%10==0) { 00276 counter->StepIt(); 00277 if (counter->isCanceled()) { // キャンセル 00278 free_CmnHead(&hd); 00279 hd.xsize = JBXL_GRAPH_CANCEL; 00280 hd.kind = HEADER_NONE; 00281 return hd; 00282 } 00283 } 00284 } 00285 } 00286 00287 if (hd.depth==16) { 00288 if (checkBit(chd->kind, HAS_LENDIAN) && is_little_endian()) { 00289 // CPU とファイルが同じ Little Endianなので,何もしない. 00290 } 00291 else { 00292 sWord* wptr = (sWord*)hd.grptr; 00293 for (int i=0; i<hd.xsize*hd.ysize*hd.zsize; i++) wptr[i] = ntohs(wptr[i]); 00294 } 00295 } 00296 00297 if (counter!=NULL) counter->PutFill(); 00298 return hd; 00299 }
CmnHead jbxl::readXHead(const char* fn, CmnHead* chd)
ファイルの Commonヘッダ情報を読み込む.データ本体は読み込まない. ファイル種別の識別に使用する.
fn | ヘッダの読み込みを行うファイル名. | |
[out] | chd | ヘッダ情報を格納する. |
読み込んだグラフィックデータを記述する共通ヘッダ(データ本体は無し).@n | エラーなら kind=HEADER_ERROR となる. |
Definition at line 666 of file Gio.cpp.
References CTHead::anydata, CmnHead::bsize, CmnHead::buf, CTHead::cutdown, CTHead::cutleft, CTHead::cutright, CTHead::cutup, CmnHead::depth, DICOM_DATA, dicomHeader(), file_size(), free_Buffer(), free_CmnHead(), CmnHead::grptr, HAS_RZXY, HEADER_NONE, JBXL_GRAPH_MEMORY_ERROR, JBXL_GRAPH_NOFILE_ERROR, JBXL_GRAPH_OPFILE_ERROR, JPEG_RGB_DATA, CmnHead::kind, CmnHead::lsize, MOON_DATA, ntoh_ar, ntoh_st, NUM_KDATA, PRINT_MESG, RAS_DATA, RAS_MAGIC, read_Buffer_data(), RZXY_RATE, UN_KNOWN_DATA, USERSET_DATA, CTHead::xsize, CmnHead::xsize, CTHead::ysize, CmnHead::ysize, and CmnHead::zsize.
Referenced by readGraphicSlices().
00667 { 00668 FILE *fp; 00669 int fsz, hsz, csz; 00670 CmnHead hd; 00671 00672 hsz = sizeof(CmnHead); 00673 memset(&hd, 0, hsz); 00674 hd.kind = HEADER_NONE; 00675 00676 fsz = (int)file_size(fn); 00677 if (fsz<=0) { 00678 hd.xsize = JBXL_GRAPH_NOFILE_ERROR; 00679 return hd; 00680 } 00681 00683 // オペレータ指定のデータ形式を確認(予めヘッダに情報が設定されている) 00684 // 00685 if (chd!=NULL && (chd->kind&0x00ff)==USERSET_DATA) { 00686 if (chd->zsize<=0) chd->zsize = 1; 00687 chd->lsize = chd->xsize*chd->ysize*chd->zsize*((chd->depth+7)/8); 00688 if (fsz==(int)(chd->bsize+chd->lsize)) { // ファイルサイズのチェック 00689 return *chd; 00690 } 00691 } 00692 00693 if ((fp=fopen(fn,"rb"))==NULL) { 00694 hd.xsize = JBXL_GRAPH_OPFILE_ERROR; 00695 return hd; 00696 } 00697 00699 // 共通ヘッダの読み込み 00700 // 00701 fseek(fp, 0, 0); 00702 fread(&hd, hsz, 1, fp); 00703 hd.grptr = NULL; 00704 ntoh_st(&hd, 4); 00705 00706 // Sun Raster 00707 if (hd.kind==RAS_MAGIC) { 00708 hd.kind = RAS_DATA; 00709 PRINT_MESG("readXHead: Sun Raster File\n"); 00710 fclose(fp); 00711 hd.depth = hd.zsize; 00712 hd.zsize = 1; 00713 hd.lsize = file_size(fn) - sizeof(RasHead); 00714 hd.bsize = 0; 00715 hd.buf = NULL; 00716 hd.grptr = NULL; 00717 return hd; 00718 } 00719 00720 // Common ヘッダ 00721 if (hd.kind>0 && hd.kind<=NUM_KDATA && fsz==(int)(hsz+hd.bsize+hd.lsize)) { 00722 if (hd.zsize<=0) hd.zsize = 1; 00723 if (hd.bsize>0) { 00724 hd.buf = (uByte*)malloc(hd.bsize); 00725 if (hd.buf==NULL) { 00726 free_CmnHead(&hd); 00727 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00728 hd.kind = HEADER_NONE; 00729 fclose(fp); 00730 return hd; 00731 } 00732 00733 fseek(fp, hsz, 0); 00734 fread(hd.buf, hd.bsize, 1, fp); 00735 ntoh_ar((sWord*)hd.buf, hd.bsize); 00736 } 00737 00738 PRINT_MESG("readXHead: Common ヘッダ\n"); 00739 PRINT_MESG("readXHead: ヘッダ種別 kind = %d\n", hd.kind); 00740 PRINT_MESG("readXHead: ファイルサイズ fsz = %d\n", fsz); 00741 PRINT_MESG("readXHead: ヘッダサイズ hsz = %d\n", sizeof(CmnHead)); 00742 PRINT_MESG("readXHead: ヘッダバッファ bsize = %d\n", hd.bsize); 00743 PRINT_MESG("readXHead: データサイズ lsize = %d\n", hd.lsize); 00744 PRINT_MESG("readXHead: サイズ %dx%dx%d %d\n", hd.xsize, hd.ysize, hd.zsize, hd.depth); 00745 00746 fclose(fp); 00747 return hd; 00748 } 00749 memset(&hd, 0, hsz); 00750 00752 // CT File (Moon) 00753 // 00754 CTHead cthd; 00755 csz = sizeof(CTHead); 00756 fseek(fp, 0, 0); 00757 fread(&cthd, csz, 1, fp); 00758 ntoh_st(&cthd, 2); 00759 00760 hd.xsize = cthd.xsize - cthd.cutleft - cthd.cutright; 00761 hd.ysize = cthd.ysize - cthd.cutup - cthd.cutdown; 00762 hd.zsize = 1; 00763 hd.depth = 16; 00764 hd.bsize = csz; 00765 hd.lsize = hd.xsize*hd.ysize*hd.zsize*((hd.depth+7)/8); 00766 00767 if (fsz==(int)(hd.bsize+hd.lsize)) { 00768 hd.kind = MOON_DATA; 00769 hd.buf = (uByte*)malloc(csz); 00770 if (hd.buf==NULL) { 00771 free_CmnHead(&hd); 00772 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00773 hd.kind = HEADER_NONE; 00774 fclose(fp); 00775 return hd; 00776 } 00777 memcpy(hd.buf, &cthd, csz); 00778 00779 PRINT_MESG("readXHead: CT ファイル\n"); 00780 PRINT_MESG("readXHead: ヘッダ種別 kind = %d\n", hd.kind); 00781 PRINT_MESG("readXHead: ファイルサイズ fsz = %d\n", fsz); 00782 PRINT_MESG("readXHead: ヘッダサイズ hsz = %d\n", sizeof(CmnHead)); 00783 PRINT_MESG("readXHead: ヘッダバッファ bsize = %d\n", hd.bsize); 00784 PRINT_MESG("readXHead: データサイズ lsize = %d\n", hd.lsize); 00785 PRINT_MESG("readXHead: サイズ %dx%dx%d %d\n", hd.xsize, hd.ysize, hd.zsize, hd.depth); 00786 00787 fclose(fp); 00788 return hd; 00789 } 00790 memset(&hd, 0, hsz); 00791 00793 // Dicom 00794 // 00795 int ls, sz, dsize, xsize, ysize, depth; 00796 double rzxy; 00797 00798 sz = dicomHeader(fp, fsz, &dsize, &xsize, &ysize, &depth, &rzxy); 00799 ls = xsize*ysize*((depth+7)/8); 00800 if (sz>0 && dsize==ls) { 00801 hd.kind = DICOM_DATA; 00802 hd.xsize = xsize; 00803 hd.ysize = ysize; 00804 hd.zsize = 1; 00805 hd.depth = depth; 00806 hd.bsize = sizeof(CTHead); 00807 hd.lsize = ls; 00808 hd.buf = (uByte*)malloc(hd.bsize); 00809 hd.grptr = NULL; 00810 00811 CTHead* pcthd = (CTHead*)hd.buf; 00812 memset(pcthd, 0, hd.bsize); 00813 pcthd->xsize = hd.xsize; 00814 pcthd->ysize = hd.ysize; 00815 00816 if (rzxy>0.0) { 00817 pcthd->anydata[0] = (sWord)(rzxy*RZXY_RATE); 00818 pcthd->anydata[1] = RZXY_RATE; 00819 hd.kind |= HAS_RZXY; 00820 } 00821 00822 fclose(fp); 00823 return hd; 00824 } 00825 00827 // Well Known ファイル 00828 // 00829 fseek(fp, 0, 0); 00830 Buffer buf = read_Buffer_data(fp, 32); 00831 00832 00833 // TIFF 00834 /* 00835 if (head[0]=='I' && head[1]=='I') { 00836 if (head[2]==0x2a && head[3]==0x00) { 00837 PRINT_MESG("readXHead: TIFFデータ形式\n"); 00838 hd.kind = TIFF_DATA; 00839 fclose(fp); 00840 return hd; 00841 } 00842 } 00843 if (head[0]=='M' && head[1]=='M') { 00844 if (head[2]==0x00 && head[3]==0x2a) { 00845 PRINT_MESG("readXHead: TIFFデータ形式\n"); 00846 hd.kind = TIFF_DATA; 00847 fclose(fp); 00848 return hd; 00849 } 00850 }*/ 00851 00852 #ifdef ENABLE_JPEGLIB 00853 // JPEG 00854 if (isJPEGHeader(buf)) { 00855 PRINT_MESG("readXHead: JPEGデータ形式\n"); 00856 hd.kind = JPEG_RGB_DATA; // JPEG_RGB_DATA or JPEG_MONO_DATA 00857 fclose(fp); 00858 free_Buffer(&buf); 00859 return hd; 00860 } 00861 #endif 00862 00863 free_Buffer(&buf); 00864 00866 // Another Unknown File Format 00867 // 00868 PRINT_MESG("readXHead: 未知のデータ形式\n"); 00869 memset(&hd, 0, hsz); 00870 hd.kind = UN_KNOWN_DATA; 00871 hd.lsize = fsz; 00872 00873 fclose(fp); 00874 return hd; 00875 }
CmnHead jbxl::readXHeadFile(const char* fn, CmnHead* chd, bool cnt=false)
データ種別を自動判定して,グラフィックデータを読み込み,Common 形式に変換する.
USERSET_DATAの場合は chd を指定する.また chdの kind にはオプションの情報も入れられる(現在はエンディアンのみ)
サポートしているデータ形式は,
ただし,UN_KNOWN_DATAの場合は CmnHaedの hd->kind, hd->lsize(ファイル長), hd->gptrのみ有効.
fn | 読み込むを行うファイル名. | |
[in,out] | chd | USERSET_DATA指定の場合,ファイルのヘッダ情報を入れる. またはファイルに関するオプション情報も指定できる(現在はエンディアンの情報のみ). |
cnt | 仮想カウンタを使用するか? |
JBXL_GRAPH_OPFILE_ERROR | xsize ファイルオープンエラー. | |
JBXL_GRAPH_MEMORY_ERROR | xsize メモリエラー. | |
JBXL_GRAPH_CANCEL | xsize キャンセル by ユーザ |
Definition at line 909 of file Gio.cpp.
References CmnHead::bsize, CmnHead::buf, checkBit, CmnHead::depth, DICOM_DATA, file_size(), free_Buffer(), free_CmnHead(), GetUsableGlobalCounter(), MSGraph< T >::gp, CmnHead::grptr, HAS_LENDIAN, HAS_RZXY, HEADER_NONE, is_little_endian(), CVCounter::isCanceled(), JBXL_GRAPH_CANCEL, JBXL_GRAPH_MEMORY_ERROR, JBXL_GRAPH_NOFILE_ERROR, JBXL_GRAPH_OPFILE_ERROR, JPEG_MONO_DATA, CmnHead::kind, CmnHead::lsize, MOON_DATA, ntoh_ar, ntoh_st, NUM_KDATA, PRINT_MESG, CVCounter::PutFill(), RAS_MAGIC, read_Buffer_data(), readDicomData(), readMoonData(), readRasData(), readUserSetData(), MSGraph< T >::RZxy, RZXY_RATE, CVCounter::SetMax(), CVCounter::SetPos(), CVCounter::StepIt(), UN_KNOWN_DATA, USERSET_DATA, MSGraph< T >::xs, CmnHead::xsize, MSGraph< T >::ys, CmnHead::ysize, MSGraph< T >::zs, and CmnHead::zsize.
Referenced by readGraphicFile().
00910 { 00911 FILE* fp; 00912 int fsz, hsz; 00913 bool no_ntoh = false; 00914 CmnHead hd; 00915 CVCounter* counter = NULL; 00916 00917 memset(&hd, 0, sizeof(CmnHead)); 00918 hd.kind = HEADER_NONE; 00919 00920 fsz = (int)file_size(fn); 00921 if (fsz==0) { 00922 hd.xsize = JBXL_GRAPH_NOFILE_ERROR; 00923 return hd; 00924 } 00925 00926 if ((fp=fopen(fn,"rb"))==NULL) { 00927 hd.xsize = JBXL_GRAPH_OPFILE_ERROR; 00928 return hd; 00929 } 00930 00932 // オペレータ指定のデータ形式を確認(予めヘッダに情報が設定されている) 00933 // 00934 if (chd!=NULL) { 00935 // ファイルとCPUのエンディアンが同じ 00936 if (checkBit(chd->kind, HAS_LENDIAN) && is_little_endian()) { 00937 no_ntoh = true; 00938 } 00939 00940 // オペレータ指定のデータ形式.カウンタ未サポート 00941 if ((chd->kind&0x00ff)==USERSET_DATA) { 00942 if (chd->zsize<=0) chd->zsize = 1; 00943 chd->lsize = chd->xsize*chd->ysize*chd->zsize*((chd->depth+7)/8); 00944 if (fsz==(int)(chd->bsize+chd->lsize)) { // ファイルサイズのチェック 00945 PRINT_MESG("readXHeadFile: オペレータ指定のデータ形式\n"); 00946 hd = readUserSetData(fp, chd, true); // カウンタ有効 00947 00948 // 24, 32bit 未対応 00949 if (hd.depth==16 && !no_ntoh) { 00950 sWord* wptr = (sWord*)hd.grptr; 00951 for (int i=0; i<hd.xsize*hd.ysize*hd.zsize; i++) { 00952 wptr[i] = ntohs(wptr[i]); 00953 } 00954 } 00955 00956 fclose(fp); 00957 return hd; 00958 } 00959 } 00960 } 00961 00963 // 共通ヘッダの読み込み 00964 // 00965 hsz = sizeof(CmnHead); 00966 fseek(fp, 0, 0); 00967 fread(&hd, hsz, 1, fp); 00968 ntoh_st(&hd, 4); 00969 00970 // Sun Raster 00971 if (hd.kind==RAS_MAGIC) { 00972 PRINT_MESG("readXHeadFile: Sun Rasterデータ形式\n"); 00973 hd = readRasData(fp); 00974 fclose(fp); 00975 return hd; 00976 } 00977 00978 // Common形式 00979 // データ読み取りでは hd.lsize==0 のファイルサイズ無効(CT_RGN_SL)はまだサポートされていない 00980 if (hd.kind>0 && hd.kind<=NUM_KDATA && fsz==(int)(hsz+hd.bsize+hd.lsize)) { 00981 PRINT_MESG("readXHeadFile: Commonデータ形式\n"); 00982 if (hd.zsize<=0) hd.zsize = 1; 00983 00984 // カウンタ 00985 if (hd.zsize>=10 && cnt) { 00986 counter = GetUsableGlobalCounter(); 00987 if (counter!=NULL) { 00988 //counter->SetTitle("Commonファイル読み込み中"); 00989 counter->SetMax(hd.zsize/10); 00990 counter->SetPos(0); 00991 } 00992 } 00993 00994 if (hd.bsize>0) hd.buf = (uByte*)malloc(hd.bsize); 00995 hd.grptr = (uByte*)malloc(hd.lsize); 00996 if ((hd.bsize>0&&hd.buf==NULL) || hd.grptr==NULL) { 00997 free_CmnHead(&hd); 00998 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 00999 hd.kind = HEADER_NONE; 01000 fclose(fp); 01001 return hd; 01002 } 01003 fseek(fp, hsz, 0); 01004 if (hd.bsize>0) { 01005 fread(hd.buf, hd.bsize, 1, fp); 01006 ntoh_ar((sWord*)hd.buf, hd.bsize); 01007 } 01008 01009 // ヘッダのみ 01010 if (hd.lsize==0) { 01011 fclose(fp); 01012 if (counter!=NULL) counter->PutFill(); 01013 return hd; 01014 } 01015 01016 // データ本体 01017 if (counter==NULL) { 01018 fread(hd.grptr, hd.lsize, 1, fp); 01019 } 01020 else { 01021 int psize = hd.xsize*hd.ysize*((hd.depth+7)/8); 01022 for (int i=0; i<hd.zsize; i++) { 01023 fread(hd.grptr+i*psize, psize, 1, fp); 01024 if (i%10==0) { 01025 counter->StepIt(); 01026 if (counter->isCanceled()) { // キャンセル 01027 //counter->Stop(); 01028 free_CmnHead(&hd); 01029 hd.xsize = JBXL_GRAPH_CANCEL; 01030 hd.kind = HEADER_NONE; 01031 fclose(fp); 01032 return hd; 01033 } 01034 } 01035 } 01036 } 01037 01038 // 24, 32bit 未対応 01039 if (hd.depth==16 && !no_ntoh) { 01040 sWord* wptr = (sWord*)hd.grptr; 01041 for (int i=0; i<hd.xsize*hd.ysize*hd.zsize; i++) { 01042 wptr[i] = ntohs(wptr[i]); 01043 } 01044 } 01045 01046 fclose(fp); 01047 if (counter!=NULL) counter->PutFill(); 01048 return hd; 01049 } 01050 memset(&hd, 0, hsz); 01051 01053 // Moon形式 16bit 01054 // 01055 hd = readMoonData(fp, fsz, no_ntoh); 01056 if ((hd.kind & 0x00ff)==MOON_DATA) { 01057 PRINT_MESG("readXHeadFile: Moonデータ形式\n"); 01058 fclose(fp); 01059 return hd; 01060 } 01061 memset(&hd, 0, hsz); 01062 01064 // DICOMファイル 01065 // 01066 MSGraph<sWord> vp = readDicomData(fp, fsz); 01067 if (vp.gp!=NULL) { 01068 PRINT_MESG("readXHeadFile: DICOMデータ形式\n"); 01069 hd.kind = DICOM_DATA; 01070 hd.xsize = vp.xs; 01071 hd.ysize = vp.ys; 01072 hd.zsize = vp.zs; 01073 hd.depth = 16; 01074 hd.bsize = sizeof(CTHead); 01075 hd.lsize = vp.xs*vp.ys*vp.zs*2; 01076 hd.buf = (uByte*)malloc(hd.bsize); 01077 hd.grptr = (uByte*)vp.gp; 01078 01079 CTHead* pcthd = (CTHead*)hd.buf; 01080 memset(pcthd, 0, hd.bsize); 01081 pcthd->xsize = (sWord)hd.xsize; 01082 pcthd->ysize = (sWord)hd.ysize; 01083 //pcthd->ctmin = 0; 01084 //pcthd->ctmax = 0; 01085 //pcthd->cutup = 0; 01086 //pcthd->cutdown = 0; 01087 //pcthd->cutleft = 0; 01088 //pcthd->cutright = 0; 01089 01090 if (vp.RZxy>0.0) { 01091 pcthd->anydata[0] = (sWord)(vp.RZxy*RZXY_RATE); 01092 pcthd->anydata[1] = RZXY_RATE; 01093 hd.kind |= HAS_RZXY; 01094 } 01095 01096 if (!no_ntoh) { 01097 sWord* wptr = (sWord*)hd.grptr; 01098 for (int i=0; i<hd.xsize*hd.ysize*hd.zsize; i++) { 01099 wptr[i] = ntohs(wptr[i]); 01100 } 01101 } 01102 01103 fclose(fp); 01104 return hd; 01105 } 01106 01108 // Well Known ファイル 01109 // 01110 fseek(fp, 0, 0); 01111 Buffer buf = read_Buffer_data(fp, 32); 01112 01114 // TIFF 01115 /* 01116 fread(head, 32, 1, fp); 01117 if (head[0]=='I' && head[1]=='I') { 01118 if (head[2]==0x2a && head[3]==0x00) { 01119 PRINT_MESG("readXHeadFile: TIFFデータ形式\n"); 01120 hd.kind = TIFF_DATA; 01121 //fclose(fp); 01122 //return hd; 01123 } 01124 } 01125 if (head[0]=='M' && head[1]=='M') { 01126 if (head[2]==0x00 && head[3]==0x2a) { 01127 PRINT_MESG("readXHeadFile: TIFFデータ形式\n"); 01128 hd.kind = TIFF_DATA; 01129 //fclose(fp); 01130 //return hd; 01131 } 01132 }*/ 01133 01134 #ifdef ENABLE_JPEGLIB 01135 // JPEG 01136 if (isJPEGHeader(buf)) { 01137 PRINT_MESG("readXHeadFile: JPEGデータ形式\n"); 01138 JPEGImage jpg = readJPEGData(fp); 01139 hd = JPEGImage2CmnHead(jpg); 01140 01141 if (hd.zsize==1) hd.kind = JPEG_MONO_DATA; 01142 jpg.free(); 01143 free_Buffer(&buf); 01144 fclose(fp); 01145 return hd; 01146 } 01147 #endif 01148 01149 free_Buffer(&buf); 01150 01152 // 解析不能.データのまま読み込み UN_KNOWN_DATA 01153 // 01154 PRINT_MESG("readXHeadFile: 未知のデータ形式\n"); 01155 memset(&hd, 0, hsz); 01156 01157 hd.grptr = (uByte*)malloc(fsz); 01158 if (hd.grptr==NULL) { 01159 hd.xsize = JBXL_GRAPH_MEMORY_ERROR; 01160 hd.kind = HEADER_NONE; 01161 fclose(fp); 01162 return hd; 01163 } 01164 fseek(fp, 0, 0); 01165 fread(hd.grptr, fsz, 1, fp); 01166 01167 hd.kind = UN_KNOWN_DATA; 01168 hd.lsize = fsz; 01169 01170 fclose(fp); 01171 return hd; 01172 }
MSGraph<T> jbxl::reduce_MSGraph | ( | MSGraph< T > | vp, | |
double | rc, | |||
int | mode = ON | |||
) | [inline] |
Definition at line 1847 of file Graph.h.
References MSGraph< T >::color, MSGraph< T >::gp, MSGraph< T >::init(), MSGraph< T >::isNull(), JBXL_GRAPH_IVDARG_ERROR, JBXL_GRAPH_NODATA_ERROR, ON, MSGraph< T >::point(), MSGraph< T >::set(), MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
01848 { 01849 int xss, yss, ps, pz, py; 01850 MSGraph<T> vx; 01851 01852 vx.init(); 01853 01854 if (vp.gp==NULL) { 01855 vx.state = JBXL_GRAPH_NODATA_ERROR; 01856 return vx; 01857 } 01858 if (rc==0.0) { 01859 vx.state = JBXL_GRAPH_IVDARG_ERROR; 01860 return vx; 01861 } 01862 else if (rc<0.0) rc = -rc; 01863 01864 xss = (int)(vp.xs/rc); 01865 yss = (int)(vp.ys/rc); 01866 01867 vx.set(xss, yss, vp.zs); 01868 if (vx.isNull()) return vx; 01869 vx.color = vp.color; 01870 01871 ps = xss*yss; 01872 01873 if (mode==ON) { 01874 int ii, jj, kk, ll, ss, nn; 01875 01876 for(int z=0; z<vx.zs; z++) { 01877 pz = z*ps; 01878 for(int j=0; j<yss; j++) { 01879 py = pz + j*xss; 01880 for(int i=0; i<xss; i++) { 01881 ii = (int)(i*rc); 01882 jj = (int)(j*rc); 01883 if (ii>=vp.xs) ii = vp.xs - 1; 01884 if (jj>=vp.ys) jj = vp.ys - 1; 01885 01886 ss = nn = 0; 01887 for(int l=jj; l<jj+(int)rc; l++) { 01888 ll = l; 01889 if (ll>=vp.ys) ll = vp.ys - 1; 01890 for(int k=ii; k<ii+(int)rc; k++) { 01891 kk = k; 01892 if (kk>=vp.xs) kk = vp.xs - 1; 01893 ss += vp.point(kk, ll, z); 01894 nn++; 01895 } 01896 } 01897 vx.gp[py+i] = ss/nn; 01898 } 01899 } 01900 } 01901 } 01902 01903 else { 01904 int ii, jj; 01905 01906 for(int k=0; k<vx.zs; k++) { 01907 pz = k*ps; 01908 for(int j=0; j<yss; j++) { 01909 py = pz + j*xss; 01910 for(int i=0; i<xss; i++) { 01911 ii = (int)(i*rc); 01912 jj = (int)(j*rc); 01913 if (ii>=vp.xs) ii = vp.xs - 1; 01914 if (jj>=vp.ys) jj = vp.ys - 1; 01915 vx.gp[py+i] = vp.point(ii, jj, k); 01916 } 01917 } 01918 } 01919 } 01920 01921 return vx; 01922 }
DllExport void ReverseContours | ( | BREP_SOLID * | solid | ) |
void jbxl::ReverseContours(BREP_SOLID* solid)
削除マークの付いたFacet(Contour)を削除し,同じ頂点を持つContourを裏返して登録する. もし,登録した Contourに多重 Edgeがある場合は登録を中止する.
ただし,読み込み(初期)データは削除しない.
Contours List と Wings Listの内容は保障される.
Definition at line 545 of file TriBrep.cpp.
References BREP_FACET, BREP_FACET::CloseData(), CreateContourByVertex(), CreateContoursList(), CreateWingsList(), DupEdgeNumber(), FastDeleteFacet(), BREP_WING::prev, BREP_FACET::shell, BREP_SOLID::shells, and BREP_WING::vertex.
Referenced by DeleteSurplusContours().
00546 { 00547 // 全ての Facetに対して 00548 BREP_SHELL_LIST shells = solid->shells; 00549 BREP_SHELL_LIST::iterator ishell; 00550 for (ishell=shells.begin(); ishell!=shells.end(); ishell++){ 00551 BREP_FACET_LIST::iterator ifacet; 00552 for (ifacet =(*ishell)->facets.begin(); ifacet!=(*ishell)->facets.end(); ifacet++){ 00553 // 削除マークが付いているなら 00554 if ((*ifacet)->deletable && !(*ifacet)->notdelete) { 00555 // 逆周りで頂点を Vector vに格納 00556 BREP_VERTEX* v[3]; 00557 BREP_FACET* pbfc; 00558 BREP_CONTOUR* pbcn; 00559 BREP_CONTOUR_LIST::iterator icon; 00560 for (icon=(*ifacet)->outer_contours.begin(); icon!=(*ifacet)->outer_contours.end(); icon++) { 00561 BREP_WING* wing = (*icon)->wing; 00562 for (int i=0; i<3; i++) { 00563 v[i] = wing->vertex; 00564 wing = wing->prev; 00565 } 00566 } 00567 00568 // 削除マークが付いている Facetを削除 00569 pbfc = *ifacet; 00570 ifacet = (*ishell)->facets.erase(ifacet); 00571 ifacet--; 00572 pbfc->shell = NULL; 00573 delete(pbfc); 00574 00575 // 裏返しの Contourを登録 00576 pbfc = new BREP_FACET(*ishell); 00577 pbcn = CreateContourByVertex(pbfc, v); 00578 if (pbcn!=NULL) { 00579 if (DupEdgeNumber(pbcn)==0) { 00580 pbfc->CloseData(); 00581 } 00582 else { 00583 FastDeleteFacet(pbfc); 00584 } 00585 } 00586 else { 00587 FastDeleteFacet(pbfc); 00588 } 00589 } 00590 } 00591 } 00592 00593 CreateContoursList(solid); 00594 CreateWingsList(solid); 00595 }
Definition at line 1066 of file Gdata.h.
References isLittleEndian, and swap_byte().
Referenced by _linecopy_MAT2MSG_C3().
01067 { 01068 r = (int)(((r&0x00ff)>>3)<<11); 01069 g = (int)(((g&0x00ff)>>2)<<5); 01070 b = (int) ((b&0x00ff)>>3); 01071 uWord c = (uWord)(r + g + b); 01072 01073 if (isLittleEndian) swap_byte(&c, 2, 2); 01074 return c; 01075 }
MSGraph<T> jbxl::rotate_MSGraph | ( | MSGraph< T > | vp, | |
double | th, | |||
int | mode = ON | |||
) | [inline] |
Definition at line 1992 of file Graph.h.
References MSGraph< T >::xs, and MSGraph< T >::ys.
MSGraph<T> jbxl::rotate_MSGraph | ( | MSGraph< T > | vp, | |
int | xs, | |||
int | ys, | |||
double | cst, | |||
double | snt, | |||
int | mode = ON | |||
) | [inline] |
template <typename t>=""> MSGraph<T> rotate_MSGraph(MSGraph<T> vp, int xs, int ys, double cst, double snt, int mode=ON)
反時計回りに画像を回転させる
Definition at line 1931 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::color, MSGraph< T >::gp, MSGraph< T >::isNull(), ON, MSGraph< T >::point(), MSGraph< T >::set(), MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
01932 { 01933 MSGraph<T> vs; 01934 T pt; 01935 int i, j, m, n; 01936 int ps, px, pz; 01937 double u, t, x, y, a, b; 01938 01939 vs.set(xs, ys, vp.zs, vp.zero, vp.base); 01940 if (vs.isNull()) return vs; 01941 vs.color = vp.color; 01942 01943 ps = vs.xs*vs.ys; 01944 01945 for (int k=0; k<vs.zs; k++) { 01946 pz = k*ps; 01947 for (int jj=0; jj<vs.ys; jj++) { 01948 px = pz + jj*vs.xs; 01949 for (int ii=0; ii<vs.xs; ii++) { 01950 u = ii - (vs.xs-1)/2.; 01951 t = (vs.ys-1)/2. - jj; 01952 x = u*cst + t*snt; 01953 y = - u*snt + t*cst; 01954 a = x + (vp.xs-1)/2.; 01955 b = (vp.ys-1)/2. - y; 01956 i = (int)a; 01957 j = (int)b; 01958 01959 if (i<0 || i>=vp.xs || j<0 || j>=vp.ys) { 01960 pt = vs.zero; 01961 } 01962 else { 01963 if (mode==ON) { 01964 if (a>=0.) a = a - i; 01965 else a = 0.; 01966 if (b>=0.) b = b - j; 01967 else b = 0.; 01968 01969 m = i + 1; 01970 n = j + 1; 01971 if (m>=vp.xs) m = vp.xs - 1; 01972 if (n>=vp.ys) n = vp.ys - 1; 01973 pt = (T)((1.-a)*(1.-b)*vp.point(i, j, k) + (1.-a)*b*vp.point(i, n, k) 01974 + a*(1.-b)*vp.point(m, j, k) + a*b*vp.point(m, n, k) + 0.5); 01975 } 01976 else { 01977 pt = vp.point(i, j, k); 01978 } 01979 } 01980 vs.gp[px+ii] = pt; 01981 } 01982 } 01983 } 01984 01985 return vs; 01986 }
void rotate_point | ( | int & | x, | |
int & | y, | |||
double | sxc, | |||
double | syc, | |||
double | dxc, | |||
double | dyc, | |||
double | cst, | |||
double | snt | |||
) |
[in,out] | x | in: X座標.out: 回転後のX座標. |
[in,out] | y | in: Y座標.out: 回転後のY座標. |
sxc | 回転前の座標の中心の X座標 | |
syc | 回転前の座標の中心の Y座標 | |
dxc | 回転後の座標の中心の X座標 | |
dyc | 回転後の座標の中心の Y座標 | |
cst | 回転角 cosθ | |
snt | 回転角 sinθ |
Definition at line 28 of file Graph.cpp.
Referenced by rotate_point_angle().
00029 { 00030 double a, b, u, t; 00031 00032 a = x - sxc; 00033 b = syc - y; 00034 u = a*cst - b*snt; 00035 t = a*snt + b*cst; 00036 x = (int)(u + dxc + 0.5); 00037 y = (int)(dyc - t + 0.5); 00038 00039 return; 00040 }
void rotate_point_angle | ( | int & | x, | |
int & | y, | |||
double | sxc, | |||
double | syc, | |||
double | dxc, | |||
double | dyc, | |||
double | th | |||
) |
void jbxl::rotate_point_angle(int& x, int& y, double sxc, double syc, double dxc, double dyc, double th)
[in,out] | x | in: X座標.out: 回転後のX座標. |
[in,out] | y | in: Y座標.out: 回転後のY座標. |
sxc | 回転前の座標の中心の X座標 | |
syc | 回転前の座標の中心の Y座標 | |
dxc | 回転後の座標の中心の X座標 | |
dyc | 回転後の座標の中心の Y座標 | |
th | 回転角(ラジアン) |
Definition at line 55 of file Graph.cpp.
References rotate_point().
00056 { 00057 double cst = (double)cos(th); 00058 double snt = (double)sin(th); 00059 00060 rotate_point(x, y, sxc, syc, dxc, dyc, cst, snt); 00061 00062 return; 00063 }
Vector<T> jbxl::RotMatrix2ExtEulerXYZ | ( | Matrix< T > | mtx, | |
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1162 of file Rotation.h.
References Matrix< T >::element().
Referenced by RotMatrix2Quaternion().
01163 { 01164 T m11 = mtx.element(1, 1); 01165 T m12 = mtx.element(1, 2); 01166 T m13 = mtx.element(1, 3); 01167 T m21 = mtx.element(2, 1); 01168 T m31 = mtx.element(3, 1); 01169 T m32 = mtx.element(3, 2); 01170 T m33 = mtx.element(3, 3); 01171 01172 Vector<T> eul = RotMatrixElements2ExtEulerXYZ<T>(m11, m12, m13, m21, m31, m32, m33, vct); 01173 01174 return eul; 01175 }
Vector<T> jbxl::RotMatrix2ExtEulerXZY | ( | Matrix< T > | mtx, | |
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1195 of file Rotation.h.
References Matrix< T >::element().
Referenced by Quaternion2ExtEulerXZY().
01196 { 01197 T m11 = mtx.element(1, 1); 01198 T m12 = mtx.element(1, 2); 01199 T m13 = mtx.element(1, 3); 01200 T m21 = mtx.element(2, 1); 01201 T m22 = mtx.element(2, 2); 01202 T m23 = mtx.element(2, 3); 01203 T m31 = mtx.element(3, 1); 01204 01205 Vector<T> eul = RotMatrixElements2ExtEulerXZY<T>(m11, m12, m13, m21, m22, m23, m31, vct); 01206 01207 return eul; 01208 }
Vector<T> jbxl::RotMatrix2ExtEulerYXZ | ( | Matrix< T > | mtx, | |
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1227 of file Rotation.h.
References Matrix< T >::element().
Referenced by Quaternion2ExtEulerYXZ().
01228 { 01229 T m12 = mtx.element(1, 2); 01230 T m21 = mtx.element(2, 1); 01231 T m22 = mtx.element(2, 2); 01232 T m23 = mtx.element(2, 3); 01233 T m31 = mtx.element(3, 1); 01234 T m32 = mtx.element(3, 2); 01235 T m33 = mtx.element(3, 3); 01236 01237 Vector<T> eul = RotMatrixElements2ExtEulerYXZ<T>(m12, m21, m22, m23, m31, m32, m33, vct); 01238 01239 return eul; 01240 }
Vector<T> jbxl::RotMatrix2ExtEulerYZX | ( | Matrix< T > | mtx, | |
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1211 of file Rotation.h.
References Matrix< T >::element().
Referenced by Quaternion2ExtEulerYZX().
01212 { 01213 T m11 = mtx.element(1, 1); 01214 T m12 = mtx.element(1, 2); 01215 T m13 = mtx.element(1, 3); 01216 T m21 = mtx.element(2, 1); 01217 T m22 = mtx.element(2, 2); 01218 T m31 = mtx.element(3, 1); 01219 T m32 = mtx.element(3, 2); 01220 01221 Vector<T> eul = RotMatrixElements2ExtEulerYZX<T>(m11, m12, m13, m21, m22, m31, m32, vct); 01222 01223 return eul; 01224 }
Vector<T> jbxl::RotMatrix2ExtEulerZXY | ( | Matrix< T > | mtx, | |
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1243 of file Rotation.h.
References Matrix< T >::element().
Referenced by Quaternion2ExtEulerZXY().
01244 { 01245 T m12 = mtx.element(1, 2); 01246 T m13 = mtx.element(1, 3); 01247 T m21 = mtx.element(2, 1); 01248 T m22 = mtx.element(2, 2); 01249 T m23 = mtx.element(2, 3); 01250 T m32 = mtx.element(3, 2); 01251 T m33 = mtx.element(3, 3); 01252 01253 Vector<T> eul = RotMatrixElements2ExtEulerZXY<T>(m12, m13, m21, m22, m23, m32, m33, vct); 01254 01255 return eul; 01256 }
Vector<T> jbxl::RotMatrix2ExtEulerZYX | ( | Matrix< T > | mtx, | |
Vector< T > * | vct | |||
) | [inline] |
Definition at line 1179 of file Rotation.h.
References Matrix< T >::element().
Referenced by Quaternion2ExtEulerZYX().
01180 { 01181 T m11 = mtx.element(1, 1); 01182 T m12 = mtx.element(1, 2); 01183 T m13 = mtx.element(1, 3); 01184 T m21 = mtx.element(2, 1); 01185 T m23 = mtx.element(2, 3); 01186 T m31 = mtx.element(3, 1); 01187 T m33 = mtx.element(3, 3); 01188 01189 Vector<T> eul = RotMatrixElements2ExtEulerZYX<T>(m11, m12, m13, m21, m23, m31, m33, vct); 01190 01191 return eul; 01192 }
Quaternion<T> jbxl::RotMatrix2Quaternion | ( | Matrix< T > | mtx | ) | [inline] |
Definition at line 1331 of file Rotation.h.
References RotMatrix2ExtEulerXYZ(), and Quaternion< T >::setExtEulerXYZ().
01332 { 01333 Quaternion<T> qut; 01334 Vector<T> xyz = RotMatrix2ExtEulerXYZ(mtx); 01335 qut.setExtEulerXYZ(xyz); 01336 01337 return qut; 01338 }
Vector<T> jbxl::RotMatrixElements2ExtEulerXYZ | ( | T | m11, | |
T | m12, | |||
T | m13, | |||
T | m21, | |||
T | m31, | |||
T | m32, | |||
T | m33, | |||
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 817 of file Rotation.h.
References PI, PI_DIV2, Vector< T >::set(), Vector< T >::x, Xabs, Vector< T >::y, Vector< T >::z, and Zero_Eps.
00818 { 00819 Vector<T> eul((T)0.0, (T)0.0, (T)0.0, (T)0.0, -(T)1.0); 00820 Vector<T> ev[2]; 00821 T arctang; 00822 00823 if (m31<-(T)1.0 || m31>(T)1.0) return eul; 00824 00825 if ((T)1.0-m31<(T)Zero_Eps || (T)1.0+m31<(T)Zero_Eps) { 00826 if ((T)1.0-m31<Zero_Eps) { // m31==1.0 00827 ev[0].y = ev[1].y = -(T)PI_DIV2; 00828 ev[0].z = (T)0.0; 00829 ev[1].z = (T)PI_DIV2; 00830 arctang = (T)atan2(-m12, -m13); 00831 ev[0].x = arctang - ev[0].z; 00832 ev[1].x = arctang - ev[1].z; 00833 } 00834 else { // m31==-1.0 00835 ev[0].y = ev[1].y = (T)PI_DIV2; 00836 ev[0].z = (T)0.0; 00837 ev[1].z = (T)PI_DIV2; 00838 arctang = (T)atan2(m12, m13); 00839 ev[0].x = arctang + ev[0].z; 00840 ev[1].x = arctang + ev[1].z; 00841 } 00842 } 00843 00844 else { 00845 ev[0].y = -(T)asin(m31); 00846 if (ev[0].y>=(T)0.0) ev[1].y = (T)PI - ev[0].y; // 別解 00847 else ev[1].y = - (T)PI - ev[0].y; 00848 00849 T cy1 = (T)cos(ev[0].y); 00850 T cy2 = (T)cos(ev[1].y); 00851 if (Xabs(cy1)<(T)Zero_Eps || Xabs(cy2)<(T)Zero_Eps) return eul; 00852 00853 ev[0].x = (T)atan2(m32/cy1, m33/cy1); 00854 ev[0].z = (T)atan2(m21/cy1, m11/cy1); 00855 00856 if (ev[0].x>=(T)0.0) ev[1].x = ev[0].x - (T)PI; 00857 else ev[1].x = ev[0].x + (T)PI; 00858 if (ev[0].z>=(T)0.0) ev[1].z = ev[0].z - (T)PI; 00859 else ev[1].z = ev[0].z + (T)PI; 00860 } 00861 00862 // 00863 // XYZ 00864 if (vct!=NULL) { 00865 vct[0].set(ev[0].x, ev[0].y, ev[0].z); 00866 vct[1].set(ev[1].x, ev[1].y, ev[1].z); 00867 } 00868 eul.set(ev[0].x, ev[0].y, ev[0].z); 00869 00870 return eul; 00871 }
Vector<T> jbxl::RotMatrixElements2ExtEulerXZY | ( | T | m11, | |
T | m12, | |||
T | m13, | |||
T | m21, | |||
T | m22, | |||
T | m23, | |||
T | m31, | |||
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 931 of file Rotation.h.
References PI, PI_DIV2, Vector< T >::set(), Vector< T >::x, Xabs, Vector< T >::y, Vector< T >::z, and Zero_Eps.
00932 { 00933 Vector<T> eul((T)0.0, (T)0.0, (T)0.0, (T)0.0, -(T)1.0); 00934 Vector<T> ev[2]; 00935 T arctang; 00936 00937 if (m21<-(T)1.0 || m21>(T)1.0) return eul; 00938 00939 if ((T)1.0-m21<(T)Zero_Eps || (T)1.0+m21<(T)Zero_Eps) { 00940 if ((T)1.0-m21<(T)Zero_Eps) { // m21==1.0 00941 ev[0].z = ev[1].z = (T)PI_DIV2; 00942 ev[0].y = (T)0.0; 00943 ev[1].y = (T)PI_DIV2; 00944 arctang = (T)atan2(m13, -m12); 00945 ev[0].x = arctang - ev[0].y; 00946 ev[1].x = arctang - ev[1].y; 00947 } 00948 else { // m21==-1.0 00949 ev[0].z = ev[1].y = -(T)PI_DIV2; 00950 ev[0].y = (T)0.0; 00951 ev[1].y = (T)PI_DIV2; 00952 arctang = (T)atan2(-m13, m12); 00953 ev[0].x = arctang + ev[0].y; 00954 ev[1].x = arctang + ev[1].y; 00955 } 00956 } 00957 00958 else { 00959 ev[0].z = (T)asin(m21); 00960 if (ev[0].z>=(T)0.0) ev[1].z = (T)PI - ev[0].z; 00961 else ev[1].z = -(T)PI - ev[0].z; 00962 00963 T cz1 = (T)cos(ev[0].z); 00964 T cz2 = (T)cos(ev[1].z); 00965 if (Xabs(cz1)<(T)Zero_Eps || Xabs(cz2)<(T)Zero_Eps) return eul; 00966 00967 ev[0].x = (T)atan2(-m23/cz1, m22/cz1); 00968 ev[0].y = (T)atan2(-m31/cz1, m11/cz1); 00969 00970 if (ev[0].x>=(T)0.0) ev[1].x = ev[0].x - (T)PI; 00971 else ev[1].x = ev[0].x + (T)PI; 00972 if (ev[0].y>=(T)0.0) ev[1].y = ev[0].y - (T)PI; 00973 else ev[1].y = ev[0].y + (T)PI; 00974 } 00975 00976 // 00977 // XZY 00978 if (vct!=NULL) { 00979 vct[0].set(ev[0].x, ev[0].z, ev[0].y); 00980 vct[1].set(ev[1].x, ev[1].z, ev[1].y); 00981 } 00982 eul.set(ev[0].x, ev[0].z, ev[0].y); 00983 00984 return eul; 00985 }
Vector<T> jbxl::RotMatrixElements2ExtEulerYXZ | ( | T | m12, | |
T | m21, | |||
T | m22, | |||
T | m23, | |||
T | m31, | |||
T | m32, | |||
T | m33, | |||
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1045 of file Rotation.h.
References PI, PI_DIV2, Vector< T >::set(), Vector< T >::x, Xabs, Vector< T >::y, Vector< T >::z, and Zero_Eps.
01046 { 01047 Vector<T> eul((T)0.0, (T)0.0, (T)0.0, (T)0.0, -(T)1.0); 01048 Vector<T> ev[2]; 01049 T arctang; 01050 01051 if (m32<-(T)1.0 || m32>(T)1.0) return eul; 01052 01053 if ((T)1.0-m32<(T)Zero_Eps || (T)1.0+m32<(T)Zero_Eps) { 01054 if ((T)1.0-m32<(T)Zero_Eps) { // m32==1.0 01055 ev[0].x = ev[1].x = (T)PI_DIV2; 01056 ev[0].z = (T)0.0; 01057 ev[1].z = (T)PI_DIV2; 01058 arctang = (T)atan2(m21, -m23); 01059 ev[0].y = arctang - ev[0].z; 01060 ev[1].y = arctang - ev[1].z; 01061 } 01062 else { // m32==-1.0 01063 ev[0].x = ev[1].x = -(T)PI_DIV2; 01064 ev[0].z = (T)0.0; 01065 ev[1].z = (T)PI_DIV2; 01066 arctang = (T)atan2(-m21, m23); 01067 ev[0].y = arctang + ev[0].z; 01068 ev[1].y = arctang + ev[1].z; 01069 } 01070 } 01071 01072 else { 01073 ev[0].x = (T)asin(m32); 01074 if (ev[0].x>=0.0) ev[1].x = (T)PI - ev[0].x; 01075 else ev[1].x = -(T)PI - ev[0].x; 01076 01077 T cx1 = (T)cos(ev[0].x); 01078 T cx2 = (T)cos(ev[1].x); 01079 if (Xabs(cx1)<(T)Zero_Eps || Xabs(cx2)<(T)Zero_Eps) return eul; 01080 01081 ev[0].y = (T)atan2(-m31/cx1, m33/cx1); 01082 ev[0].z = (T)atan2(-m12/cx1, m22/cx1); 01083 01084 if (ev[0].y>=(T)0.0) ev[1].y = ev[0].y - (T)PI; 01085 else ev[1].y = ev[0].y + (T)PI; 01086 if (ev[0].z>=(T)0.0) ev[1].z = ev[0].z - (T)PI; 01087 else ev[1].z = ev[0].z + (T)PI; 01088 } 01089 01090 // 01091 // YXZ 01092 if (vct!=NULL) { 01093 vct[0].set(ev[0].y, ev[0].x, ev[0].z); 01094 vct[1].set(ev[1].y, ev[1].x, ev[1].z); 01095 } 01096 eul.set(ev[0].y, ev[0].x, ev[0].z); 01097 01098 return eul; 01099 }
Vector<T> jbxl::RotMatrixElements2ExtEulerYZX | ( | T | m11, | |
T | m12, | |||
T | m13, | |||
T | m21, | |||
T | m22, | |||
T | m31, | |||
T | m32, | |||
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 988 of file Rotation.h.
References PI, PI_DIV2, Vector< T >::set(), Vector< T >::x, Xabs, Vector< T >::y, Vector< T >::z, and Zero_Eps.
00989 { 00990 Vector<T> eul((T)0.0, (T)0.0, (T)0.0, (T)0.0, -(T)1.0); 00991 Vector<T> ev[2]; 00992 T arctang; 00993 00994 if (m12<-(T)1.0 || m12>(T)1.0) return eul; 00995 00996 if ((T)1.0-m12<(T)Zero_Eps || (T)1.0+m12<(T)Zero_Eps) { 00997 if (1.0-m12<Zero_Eps) { // m12==1.0 00998 ev[0].z = ev[1].z = -(T)PI_DIV2; 00999 ev[0].y = (T)0.0; 01000 ev[1].y = (T)PI_DIV2; 01001 arctang = (T)atan2(-m31, -m21); 01002 ev[0].x = arctang - ev[0].y; 01003 ev[1].x = arctang - ev[1].y; 01004 } 01005 else { // m12==-1.0 01006 ev[0].z = ev[1].y = (T)PI_DIV2; 01007 ev[0].y = (T)0.0; 01008 ev[1].y = (T)PI_DIV2; 01009 arctang = (T)atan2(m31, m21); 01010 ev[0].x = arctang + ev[0].y; 01011 ev[1].x = arctang + ev[1].y; 01012 } 01013 } 01014 01015 else { 01016 ev[0].z = -(T)asin(m12); 01017 if (ev[0].z>=0.0) ev[1].z = (T)PI - ev[0].z; 01018 else ev[1].z = -(T)PI - ev[0].z; 01019 01020 T cz1 = (T)cos(ev[0].z); 01021 T cz2 = (T)cos(ev[1].z); 01022 if (Xabs(cz1)<(T)Zero_Eps || Xabs(cz2)<(T)Zero_Eps) return eul; 01023 01024 ev[0].x = (T)atan2(m32/cz1, m22/cz1); 01025 ev[0].y = (T)atan2(m13/cz1, m11/cz1); 01026 01027 if (ev[0].x>=(T)0.0) ev[1].x = ev[0].x - (T)PI; 01028 else ev[1].x = ev[0].x + (T)PI; 01029 if (ev[0].y>=(T)0.0) ev[1].y = ev[0].y - (T)PI; 01030 else ev[1].y = ev[0].y + (T)PI; 01031 } 01032 01033 // 01034 // YZX 01035 if (vct!=NULL) { 01036 vct[0].set(ev[0].y, ev[0].z, ev[0].x); 01037 vct[1].set(ev[1].y, ev[1].z, ev[1].x); 01038 } 01039 eul.set(ev[0].y, ev[0].z, ev[0].x); 01040 01041 return eul; 01042 }
Vector<T> jbxl::RotMatrixElements2ExtEulerZXY | ( | T | m12, | |
T | m13, | |||
T | m21, | |||
T | m22, | |||
T | m23, | |||
T | m32, | |||
T | m33, | |||
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 1102 of file Rotation.h.
References PI, PI_DIV2, Vector< T >::set(), Vector< T >::x, Xabs, Vector< T >::y, Vector< T >::z, and Zero_Eps.
01103 { 01104 Vector<T> eul((T)0.0, (T)0.0, (T)0.0, (T)0.0, -(T)1.0); 01105 Vector<T> ev[2]; 01106 T arctang; 01107 01108 if (m23<-(T)1.0 || m23>(T)1.0) return eul; 01109 01110 if ((T)1.0-m23<(T)Zero_Eps || (T)1.0+m23<(T)Zero_Eps) { 01111 if ((T)1.0-m23<(T)Zero_Eps) { // m23==1.0 01112 ev[0].x = ev[1].x = -(T)PI_DIV2; 01113 ev[0].z = (T)0.0; 01114 ev[1].z = (T)PI_DIV2; 01115 arctang = (T)atan2(-m12, -m32); 01116 ev[0].y = arctang - ev[0].z; 01117 ev[1].y = arctang - ev[1].z; 01118 } 01119 else { // m23==-1.0 01120 ev[0].x = ev[1].x = (T)PI_DIV2; 01121 ev[0].z = (T)0.0; 01122 ev[1].z = (T)PI_DIV2; 01123 arctang = (T)atan2(m12, m32); 01124 ev[0].y = arctang + ev[0].z; 01125 ev[1].y = arctang + ev[1].z; 01126 } 01127 } 01128 01129 else { 01130 ev[0].x = -(T)asin(m23); 01131 if (ev[0].x>=(T)0.0) ev[1].x = (T)PI - ev[0].x; 01132 else ev[1].x = -(T)PI - ev[0].x; 01133 01134 T cx1 = (T)cos(ev[0].x); 01135 T cx2 = (T)cos(ev[1].x); 01136 if (Xabs(cx1)<(T)Zero_Eps || Xabs(cx2)<(T)Zero_Eps) return eul; 01137 01138 ev[0].y = (T)atan2(m13/cx1, m33/cx1); 01139 ev[0].z = (T)atan2(m21/cx1, m22/cx1); 01140 01141 if (ev[0].y>=(T)0.0) ev[1].y = ev[0].y - (T)PI; 01142 else ev[1].y = ev[0].y + (T)PI; 01143 if (ev[0].z>=(T)0.0) ev[1].z = ev[0].z - (T)PI; 01144 else ev[1].z = ev[0].z + (T)PI; 01145 } 01146 01147 // 01148 // ZXY 01149 if (vct!=NULL) { 01150 vct[0].set(ev[0].z, ev[0].x, ev[0].y); 01151 vct[1].set(ev[1].z, ev[1].x, ev[1].y); 01152 } 01153 eul.set(ev[0].z, ev[0].x, ev[0].y); 01154 01155 return eul; 01156 }
Vector<T> jbxl::RotMatrixElements2ExtEulerZYX | ( | T | m11, | |
T | m12, | |||
T | m13, | |||
T | m21, | |||
T | m23, | |||
T | m31, | |||
T | m33, | |||
Vector< T > * | vct = NULL | |||
) | [inline] |
Definition at line 874 of file Rotation.h.
References PI, PI_DIV2, Vector< T >::set(), Vector< T >::x, Xabs, Vector< T >::y, Vector< T >::z, and Zero_Eps.
00875 { 00876 Vector<T> eul((T)0.0, (T)0.0, (T)0.0, (T)0.0, -(T)1.0); 00877 Vector<T> ev[2]; 00878 T arctang; 00879 00880 if (m13<-(T)1.0 || m13>(T)1.0) return eul; 00881 00882 if ((T)1.0-m13<(T)Zero_Eps || (T)1.0+m13<(T)Zero_Eps) { 00883 if ((T)1.0-m13<(T)Zero_Eps) { // m13==1.0 00884 ev[0].y = ev[1].y = (T)PI_DIV2; 00885 ev[0].z = (T)0.0; 00886 ev[1].z = (T)PI_DIV2; 00887 arctang = (T)atan2(m21, -m31); 00888 ev[0].x = (T)arctang - ev[0].z; 00889 ev[1].x = (T)arctang - ev[1].z; 00890 } 00891 else { // m13==-1.0 00892 ev[0].y = ev[1].y = -(T)PI_DIV2; 00893 ev[0].z = (T)0.0; 00894 ev[1].z = (T)PI_DIV2; 00895 arctang = (T)atan2(-m21, m31); 00896 ev[0].x = (T)arctang + ev[0].z; 00897 ev[1].x = (T)arctang + ev[1].z; 00898 } 00899 } 00900 00901 else { 00902 ev[0].y = (T)asin(m13); 00903 if (ev[0].y>=0.0) ev[1].y = (T)PI - ev[0].y; 00904 else ev[1].y = -(T)PI - ev[0].y; 00905 00906 T cy1 = (T)cos(ev[0].y); 00907 T cy2 = (T)cos(ev[1].y); 00908 if (Xabs(cy1)<Zero_Eps || Xabs(cy2)<Zero_Eps) return eul; 00909 00910 ev[0].x = atan2(-m23/cy1, m33/cy1); 00911 ev[0].z = atan2(-m12/cy1, m11/cy1); 00912 00913 if (ev[0].x>=(T)0.0) ev[1].x = ev[0].x - (T)PI; 00914 else ev[1].x = ev[0].x + (T)PI; 00915 if (ev[0].z>=(T)0.0) ev[1].z = ev[0].z - (T)PI; 00916 else ev[1].z = ev[0].z + (T)PI; 00917 } 00918 00919 // 00920 // ZYX 00921 if (vct!=NULL) { 00922 vct[0].set(ev[0].z, ev[0].y, ev[0].x); 00923 vct[1].set(ev[1].z, ev[1].y, ev[1].x); 00924 } 00925 eul.set(ev[0].z, ev[0].y, ev[0].x); 00926 00927 return eul; 00928 }
bool jbxl::same_vector | ( | Vector< T > | v1, | |
Vector< T > | v2 | |||
) | [inline] |
v1, v2 が同じ点かチェックする.信頼度は考慮しない.
Definition at line 229 of file Vector.h.
References Vector_Tolerance, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
00230 { 00231 T dx = v1.x - v2.x; 00232 T dy = v1.y - v2.y; 00233 T dz = v1.z - v2.z; 00234 T d2 = dx*dx + dy*dy + dz*dz; 00235 double t2 = Vector_Tolerance*Vector_Tolerance; 00236 00237 if ((double)d2>t2) return false; 00238 return true; 00239 }
DllExport bool SamePlaneContour | ( | BREP_CONTOUR * | contour1, | |
BREP_CONTOUR * | contour2, | |||
int & | lineno | |||
) |
Definition at line 1191 of file TriBrep.cpp.
References BREP_CONTOUR::directRS, Max, BREP_WING::next, TVectorMultiTolerance(), BREP_WING::vertex, Vertex2TVector(), BREP_CONTOUR::wing, Xabs, and Zero_Eps.
Referenced by IsCollisionContours().
01192 { 01193 double um, umt, tm, tmt; 01194 BREP_WING* wing = contour1->wing; 01195 TVector<double> directB, directQ; 01196 01197 lineno = 0; 01198 for (int i=0; i<3; i++) { 01199 directB = Vertex2TVector(wing->next->vertex) - Vertex2TVector(wing->vertex); 01200 directQ = Vertex2TVector(contour2->wing->vertex) - Vertex2TVector(wing->vertex); 01201 um = contour2->directRS*directB; 01202 tm = contour2->directRS*directQ; 01203 umt = TVectorMultiTolerance(contour2->directRS, directB); 01204 tmt = TVectorMultiTolerance(contour2->directRS, directQ); 01205 if (Xabs(um)<Max(umt, Zero_Eps) && Xabs(tm)<Max(tmt, Zero_Eps)) { 01206 lineno++; 01207 } 01208 } 01209 01210 if (lineno>=2) return true; 01211 return false; 01212 }
MSGraph<T> jbxl::scalingMSGraph2D | ( | MSGraph< T > | vp, | |
double | scale | |||
) | [inline] |
Definition at line 958 of file Gdata.h.
References MSGraph< T >::color, MSGraph< T >::getm(), MSGraph< T >::gp, MSGraph< T >::point(), MSGraph< T >::set(), MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
00959 { 00960 MSGraph<T> xp; 00961 00962 if (scale==0.0) return xp; 00963 00964 int xs = (int)(vp.xs*scale); 00965 int ys = (int)(vp.ys*scale); 00966 int zs = vp.zs; 00967 int ps = xs*ys; 00968 if (vp.xs*scale-xs>0.0) xs++; 00969 if (vp.ys*scale-ys>0.0) ys++; 00970 00971 xp.set(xs, ys, zs); 00972 xp.getm(); 00973 xp.color = vp.color; 00974 00975 for (int kk=0; kk<zs; kk++) { 00976 int posk = kk*ps; 00977 // 00978 for (int jj=0; jj<ys; jj++) { 00979 int posj = jj*xs + posk; 00980 double y = jj/scale; 00981 int j = (int)y; 00982 int n = j + 1; 00983 if (j>vp.ys-1) j = vp.ys-1; 00984 if (n>vp.ys-1) n = vp.ys-1; 00985 double bt = y - j; 00986 // 00987 for (int ii=0; ii<xs; ii++) { 00988 double x = ii/scale; 00989 int i = (int)x; 00990 int m = i + 1; 00991 if (j>vp.xs-1) j = vp.xs-1; 00992 if (n>vp.xs-1) n = vp.xs-1; 00993 double al = x - i; 00994 00995 T a = vp.point(i, j, kk); 00996 T b = vp.point(m, j, kk); 00997 T c = vp.point(i, n, kk); 00998 T d = vp.point(m, n, kk); 00999 T p = (T)(a*(1.0-al)*(1.0-bt) + b*al*(1.0-bt) + c*(1.0-al)*bt + d*al*bt); 01000 01001 xp.gp[ii+posj] = p; 01002 } 01003 } 01004 } 01005 01006 return xp; 01007 }
void jbxl::set_around_MSGraph | ( | MSGraph< T > | vp, | |
int | cc = 0 , |
|||
int | size = 1 | |||
) | [inline] |
template <typename t>=""> void set_around_MSGraph(MSGraph<T> vp, int cc=0, int size=1)
2Dグラフィックデータの縁の部分の輝度値を ccにする.
vp | 操作対象となるグラフィックデータ構造体. | |
cc | データの縁に設定する輝度値. | |
size | 縁のサイズ |
Definition at line 2069 of file Graph.h.
References MSGraph< T >::gp, MSGraph< T >::xs, and MSGraph< T >::ys.
Referenced by Density_Mask().
02070 { 02071 int i, j, px1, px2; 02072 /* 02073 for (i=0; i<vp.xs; i++){ 02074 px1 = i; 02075 px2 = (vp.ys-1)*vp.xs + i; 02076 vp.gp[px1] = (T)cc; 02077 vp.gp[px2] = (T)cc; 02078 } 02079 02080 for (j=1; j<vp.ys-1; j++){ 02081 px1 = j*vp.xs; 02082 px2 = (j+1)*vp.xs - 1; 02083 vp.gp[px1] = (T)cc; 02084 vp.gp[px2] = (T)cc; 02085 } 02086 */ 02087 for(j=0; j<vp.ys; j++) { 02088 px1 = j*vp.xs; 02089 px2 = (j+1)*vp.xs-size; 02090 for(i=0; i<size; i++) { 02091 vp.gp[i+px1] = (T)cc; 02092 vp.gp[i+px2] = (T)cc; 02093 } 02094 } 02095 02096 for(j=0; j<size; j++) { 02097 px1 = j*vp.xs; 02098 px2 = (j+vp.ys-size)*vp.xs; 02099 for(i=0; i<vp.xs; i++) vp.gp[i+px1] = (T)cc; 02100 for(i=0; i<vp.xs; i++) vp.gp[i+px2] = (T)cc; 02101 } 02102 02103 }
void jbxl::SetAbsVectorTolerance | ( | double | tol | ) | [inline] |
Definition at line 56 of file Tolerance.h.
References Abs_Vector_Tolerance.
00056 { Abs_Vector_Tolerance = tol; }
void jbxl::SetAbsVertexTolerance | ( | double | tol | ) | [inline] |
Definition at line 57 of file Tolerance.h.
References Abs_Vertex_Tolerance.
00057 { Abs_Vertex_Tolerance = tol; }
void jbxl::SetCollisionTolerance | ( | double | tol | ) | [inline] |
Definition at line 54 of file Tolerance.h.
References Collision_Tolerance.
00054 { Collision_Tolerance = tol; }
DllExport void SetDeletableContoursByEdge | ( | BREP_EDGE * | edge | ) |
void jbxl::SetDeletableContoursByEdge(BREP_EDGE* edge)
Edgeに関連付けられた Contourに削除可能のマークをつける.削除は行わない.
Definition at line 834 of file TriBrep.cpp.
References BREP_WING::contour, BREP_FACET::deletable, BREP_EDGE::edge_list, BREP_CONTOUR::facet, BREP_EDGE::wing1, and BREP_EDGE::wing2.
Referenced by IsForbiddenEdge().
00835 { 00836 if (edge->edge_list!=NULL) { 00837 BREP_EDGE_LIST::iterator iedge; 00838 for (iedge=edge->edge_list->begin(); iedge!=edge->edge_list->end(); iedge++){ 00839 if ((*iedge)->wing1->contour!=NULL) { 00840 (*iedge)->wing1->contour->facet->deletable = true; 00841 } 00842 if ((*iedge)->wing2->contour!=NULL) { 00843 (*iedge)->wing2->contour->facet->deletable = true; 00844 } 00845 } 00846 } 00847 else { 00848 if (edge->wing1->contour!=NULL) { 00849 edge->wing1->contour->facet->deletable = true; 00850 } 00851 if (edge->wing2->contour!=NULL) { 00852 edge->wing2->contour->facet->deletable = true; 00853 } 00854 } 00855 }
void jbxl::SetEdgeTolerance | ( | double | tol | ) | [inline] |
Definition at line 52 of file Tolerance.h.
References Edge_Tolerance.
00052 { Edge_Tolerance = tol; }
void jbxl::SetFacetTolerance | ( | double | tol | ) | [inline] |
Definition at line 53 of file Tolerance.h.
References Facet_Tolerance.
00053 { Facet_Tolerance = tol; }
void jbxl::SetGlobalCounter | ( | CVCounter * | counter | ) | [inline] |
Definition at line 192 of file ClassBox.h.
References GLCounter.
Referenced by zzSobel().
00192 { GLCounter = counter;}
void jbxl::SetGlobalDisplay | ( | CVDisplay * | disp | ) | [inline] |
void jbxl::SetGlobalFrame | ( | CVFrame * | frm | ) | [inline] |
void jbxl::SetGlobalTextDocument | ( | CVTextDocument * | doc | ) | [inline] |
Definition at line 119 of file ClassBox.h.
References GLTextDocument.
00119 { GLTextDocument = doc;}
DllExport void SetMinVertex | ( | BREP_VERTEX_LIST * | list, | |
BREP_VERTEX * | vrtx | |||
) |
void jbxl::SetMinVertex(BREP_VERTEX_LIST* list, BREP_VERTEX* vrtx)
Definition at line 457 of file TriBrep.cpp.
References BREP_VERTEX::distance2.
Referenced by FillShortageWings_Near().
00458 { 00459 BREP_VERTEX_LIST::iterator ivert; 00460 for (ivert=list->begin(); ivert!=list->end(); ivert++){ 00461 if (vrtx==(*ivert)) return; // 既に登録済み 00462 if (vrtx->distance2 < (*ivert)->distance2) { 00463 list->insert(ivert, vrtx); 00464 return; 00465 } 00466 } 00467 if (ivert==list->end()) list->push_back(vrtx); 00468 return; 00469 }
void jbxl::SetSINTolerance | ( | double | tol | ) | [inline] |
void jbxl::SetVectorTolerance | ( | double | tol | ) | [inline] |
Definition at line 50 of file Tolerance.h.
References Vector_Tolerance.
00050 { Vector_Tolerance = tol; }
void jbxl::SetVertexTolerance | ( | double | tol | ) | [inline] |
Definition at line 51 of file Tolerance.h.
References Vertex_Tolerance.
00051 { Vertex_Tolerance = tol; }
void jbxl::SetZeroEPS | ( | double | eps | ) | [inline] |
Quaternion<T> jbxl::SlerpQuaternion | ( | Quaternion< T > | qa, | |
Quaternion< T > | qb, | |||
T | t | |||
) | [inline] |
Quaternion<T> SlerpQuaternion(Quaternion<T> qa, Quaternion<T> qb, T t)
クオータニオンの球面線形補間 (Sphercal Linear Interpolation)
回転軸が変化しない,または180度反転した状態での 180度以上の回転に対応.
qa | 始点のクオータニオン | |
qb | 終点のクオータニオン | |
t | パラメータ 0〜1 |
Definition at line 1542 of file Rotation.h.
References Quaternion< T >::getMathAngle(), Quaternion< T >::getVector(), Quaternion< T >::n, Vector< T >::normalize(), Quaternion< T >::normalize(), PI, PI2, Quaternion< T >::s, Quaternion< T >::setRotation(), Sin_Tolerance, Quaternion< T >::x, Xabs, Quaternion< T >::y, and Quaternion< T >::z.
01543 { 01544 if (qa.n!=(T)1.0) qa.normalize(); 01545 if (qb.n!=(T)1.0) qb.normalize(); 01546 01547 // 01548 T dot; 01549 Quaternion<T> qc; 01550 01552 // 01553 Vector<T> va = qa.getVector(); 01554 Vector<T> vb = qb.getVector(); 01555 va.normalize(); 01556 vb.normalize(); 01557 01558 // 01559 dot = va*vb; 01560 if (dot>(T)1.0) dot = 1.0; 01561 else if (dot<-(T)1.0) dot = -1.0; 01562 01563 // 回転軸が変わらない場合 01564 if (dot>(T)1.0-Sin_Tolerance) { 01565 T anga = qa.getMathAngle(); 01566 T angb = qb.getMathAngle(); 01567 T angd = angb - anga; 01568 if (angd<-(T)PI) angd += (T)PI2; 01569 else if (angd>(T)PI) angd -= (T)PI2; 01570 01571 T angc = anga + t*angd; 01572 qc.setRotation(angc, va); 01573 qc.normalize(); 01574 return qc; 01575 } 01576 01577 // 回転軸が反転する場合 01578 // else if (dot<-(T)1.0+(T)Sin_Tolerance) { 01579 else if (dot<-(T)0.99) { 01580 T anga = qa.getMathAngle(); 01581 T angb = - qb.getMathAngle(); 01582 T angd = angb - anga; 01583 if (angd<-(T)PI) angd += (T)PI2; 01584 else if (angd>(T)PI) angd -= (T)PI2; 01585 01586 T angc = anga + t*angd; 01587 qc.setRotation(angc, va); 01588 qc.normalize(); 01589 return qc; 01590 } 01591 01592 // SLERP 01593 dot = qa.x*qb.x + qa.y*qb.y + qa.z*qb.z + qa.s*qb.s; 01594 if (dot>(T)1.0) dot = (T)1.0; 01595 else if (dot<(T)0.0) { 01596 if (t<=(T)0.5) return qa; 01597 else return qb; 01598 } 01599 //if (dot<0.0) DEBUG_WARN("SlerpQuaternion: dot = %f", dot); 01600 01601 // 01602 T th = (T)acos(dot); 01603 T sn = (T)sin(th); 01604 if (Xabs(sn)<(T)Sin_Tolerance) return qa; 01605 01606 // 01607 qc = qa*((T)sin(((T)1.0-t)*th)/sn) + qb*((T)sin(t*th)/sn); 01608 qc.normalize(); 01609 01610 return qc; 01611 }
MSGraph<T> jbxl::TGAImage2MSGraph | ( | TGAImage | tga | ) | [inline] |
template <typename t>=""> MSGraph<T> TGAImage2MSGraph(TGAImage tga)
Tgaイメージデータを MSGraph型イメージデータに変換する
tga | Tgaイメージデータ |
JBXL_GRAPH_NODATA_ERROR | state データ無し | |
JBXL_GRAPH_MEMORY_ERROR | state メモリ確保エラー |
Definition at line 76 of file TgaTool.h.
References TGAImage::col, MSGraph< T >::color, MSGraph< T >::gp, GRAPH_COLOR_BGR, GRAPH_COLOR_BGRA, GRAPH_COLOR_MA, GRAPH_COLOR_MONO, MSGraph< T >::isNull(), TGAImage::isNull(), JBXL_GRAPH_IVDARG_ERROR, JBXL_GRAPH_NODATA_ERROR, TGAImage::point(), MSGraph< T >::set(), MSGraph< T >::state, TGAImage::xs, and TGAImage::ys.
00077 { 00078 MSGraph<T> vp; 00079 00080 if (tga.isNull()) { 00081 vp.state = JBXL_GRAPH_NODATA_ERROR; 00082 return vp; 00083 } 00084 00085 vp.set(tga.xs, tga.ys, tga.col); 00086 if (vp.isNull()) return vp; 00087 // 00088 if (tga.col==4) vp.color = GRAPH_COLOR_BGRA; 00089 else if (tga.col==3) vp.color = GRAPH_COLOR_BGR; 00090 else if (tga.col==2) vp.color = GRAPH_COLOR_MA; 00091 else if (tga.col==1) vp.color = GRAPH_COLOR_MONO; 00092 else { 00093 vp.state = JBXL_GRAPH_IVDARG_ERROR; 00094 return vp; 00095 } 00096 00097 for (int k=0; k<tga.col; k++) { 00098 int zp = k*tga.xs*tga.ys; 00099 for (int j=0; j<tga.ys; j++) { 00100 int yp = zp + j*tga.xs; 00101 for (int i=0; i<tga.xs; i++) { 00102 vp.gp[yp + i] = (T)tga.point(i, j, k); 00103 } 00104 } 00105 } 00106 00107 return vp; 00108 }
void jbxl::ToPola | ( | Vector< T > | nv, | |
double & | cst, | |||
double & | snt, | |||
double & | csf, | |||
double & | snf, | |||
double | pcsf = 0.0 , |
|||
double | psnf = 1.0 | |||
) | [inline] |
template <typename t>=""> void ToPola(Vector<T> nv, double& cst, double& snt, double& csf, double& snf, double pcsf=0.0, double psnf=1.0)
ベクトル nvの単位ベクトルを極座標 (1,θ,φ) へ変換する.
ただし,θφは sin, cosの値として返される..ベクトル nvのノルムは計算されている必要がある.
[in] | nv | 方向ベクトル. |
[out] | cst | 指定しない.cosθの値が入る. |
[out] | snt | 指定しない.sinθの値が入る. |
[out] | csf | 通常は cosφの値が入る.sinθ≒0 の場合は pcsfの値が代入される. |
[out] | snf | 通常は sinφの値が入る.sinθ≒0 の場合は psnfの値が代入される. |
[in] | pcsf | sinθ≒0 の場合に csfに代入される.連続計算の場合に直前の cosφの値を指定する. |
[in] | psnf | sinθ≒0 の場合に snfに代入される.連続計算の場合に直前の sinφの値を指定する. |
Definition at line 692 of file Graph.h.
References Vector< T >::n, Vector< T >::normalize(), Sign, Sin_Tolerance, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Referenced by Local2World().
00693 { 00694 if (nv.n!=1.0) nv.normalize(); 00695 if (nv.z<-1.0) nv.z = -1.0; 00696 if (nv.z> 1.0) nv.z = 1.0; 00697 cst = nv.z; 00698 snt = sqrt(1.0-nv.z*nv.z); 00699 00700 if (snt<Sin_Tolerance) { 00701 cst = Sign(cst); 00702 snt = 0.0; 00703 csf = pcsf; 00704 snf = psnf; 00705 } 00706 else { 00707 csf = nv.x/snt; 00708 snf = nv.y/snt; 00709 } 00710 /* 00711 if (*snt<Sin_Tolerance) { 00712 *cst = Sign(*cst); 00713 *snt = 0.0; 00714 } 00715 00716 double rr = sqrt(nv.x*nv.x + nv.y*nv.y); 00717 if (rr<=Zero_Eps) { 00718 *csf = 0.0; 00719 *snf = 1.0; 00720 } 00721 else { 00722 *csf = nv.x/rr; 00723 *snf = nv.y/rr; 00724 } 00725 */ 00726 return; 00727 }
T jbxl::TVectorMultiTolerance | ( | TVector< T > | a, | |
TVector< T > | b | |||
) | [inline] |
Definition at line 186 of file TVector.h.
References Vector< T >::n, and TVector< T >::t.
Referenced by CollisionTriContour2D(), CollisionTriContour3D(), and SamePlaneContour().
Quaternion<T> jbxl::V2VQuaternion | ( | Vector< T > | a, | |
Vector< T > | b | |||
) | [inline] |
Definition at line 1444 of file Rotation.h.
References Vector< T >::c, Quaternion< T >::c, Min, Quaternion< T >::n, Vector< T >::n, Vector< T >::norm(), Vector< T >::normalize(), PI, Quaternion< T >::s, Quaternion< T >::set(), Quaternion< T >::setRotation(), Vector< T >::x, Xabs, Vector< T >::y, Vector< T >::z, and Zero_Eps.
01445 { 01446 Quaternion<T> qut((T)1.0, (T)0.0, (T)0.0, (T)0.0, (T)1.0); 01447 01448 a.normalize(); 01449 b.normalize(); 01450 if (a.n<(T)Zero_Eps || b.n<(T)Zero_Eps) return qut; 01451 01452 Vector<T> nr = a^b; 01453 nr.normalize(); 01454 01455 T cs2 = (a*b)/(T)2.0; // θ/2 = 0〜π/2 01456 01457 T sn; 01458 if (cs2>(T)0.5) sn = (T)0.0; 01459 else sn = (T)sqrt(0.5 - cs2); 01460 01461 if (Xabs(sn-(T)1.0)<(T)Zero_Eps) { 01462 Vector<T> c = a + b; 01463 if (c.norm()<(T)1.0) { 01464 qut.setRotation(PI, nr); 01465 if (nr.n<Zero_Eps) { 01466 qut.s = (T)0.0; 01467 qut.n = (T)0.0; 01468 qut.c = -(T)1.0; 01469 } 01470 } 01471 else { 01472 qut.setRotation((T)0.0, nr); 01473 } 01474 return qut; 01475 } 01476 01477 T cs; 01478 if (cs2<-(T)0.5) cs = (T)0.0; 01479 else cs = (T)sqrt(0.5 + cs2); 01480 01481 // 01482 if (cs>(T)1.0) qut.set((T)1.0, (T)0.0, (T)0.0, (T)0.0, (T)1.0, -(T)1.0); 01483 else qut.set(cs, nr.x*sn, nr.y*sn, nr.z*sn, (T)1.0, (T)Min(a.c, b.c)); 01484 01485 return qut; 01486 }
double jbxl::VectorAngle | ( | Vector< T > | a, | |
Vector< T > | b, | |||
Vector< T > | c | |||
) | [inline] |
Definition at line 269 of file Vector.h.
References VectorAngle().
00270 { 00271 return VectorAngle(b-a, c-b); 00272 }
double jbxl::VectorAngle | ( | Vector< T > | a, | |
Vector< T > | b | |||
) | [inline] |
Definition at line 255 of file Vector.h.
References Vector< T >::n, Vector< T >::normalize(), PI, and Zero_Eps.
Referenced by VectorAngle().
00256 { 00257 a.normalize(); 00258 b.normalize(); 00259 if (a.n<Zero_Eps || b.n<Zero_Eps) return 0.0; 00260 00261 double cs = a*b; 00262 if (cs>=1.0) return 0.0; 00263 else if (cs<=-1.0) return PI; 00264 00265 return acos(a*b); 00266 }
double jbxl::VectorDist | ( | const Vector< T > | a, | |
const Vector< T > | b | |||
) | [inline] |
T* jbxl::VectorInvRotation | ( | T * | v, | |
Quaternion< T > | q | |||
) | [inline] |
Definition at line 1419 of file Rotation.h.
References Quaternion< T >::s, Quaternion< T >::x, Quaternion< T >::y, and Quaternion< T >::z.
01420 { 01421 T x, y, z; 01422 01423 x = (q.s*q.s + q.x*q.x - q.y*q.y -q.z*q.z)*v[0] + 01424 ((T)2.0*q.x*q.y + (T)2.0*q.s*q.z)*v[1] + 01425 ((T)2.0*q.x*q.z - (T)2.0*q.s*q.y)*v[2]; 01426 01427 y = ((T)2.0*q.x*q.y - (T)2.0*q.s*q.z)*v[0] + 01428 (q.s*q.s - q.x*q.x + q.y*q.y - q.z*q.z)*v[1] + 01429 ((T)2.0*q.y*q.z + (T)2.0*q.s*q.x)*v[2]; 01430 01431 z = ((T)2.0*q.x*q.z + (T)2.0*q.s*q.y)*v[0] + 01432 ((T)2.0*q.y*q.z - (T)2.0*q.s*q.x)*v[1] + 01433 (q.s*q.s - q.x*q.x - q.y*q.y + q.z*q.z)*v[2]; 01434 01435 v[0] = x; 01436 v[1] = y; 01437 v[2] = z; 01438 01439 return v; 01440 }
Vector<T> jbxl::VectorInvRotation | ( | Vector< T > | v, | |
Quaternion< T > | q | |||
) | [inline] |
Definition at line 1373 of file Rotation.h.
References Quaternion< T >::s, Quaternion< T >::x, Vector< T >::x, Vector< T >::y, Quaternion< T >::y, Vector< T >::z, and Quaternion< T >::z.
Referenced by AffineTrans< double >::execInvRotate().
01374 { 01375 Vector<T> vect; 01376 01377 vect.x = (q.s*q.s + q.x*q.x - q.y*q.y -q.z*q.z)*v.x + 01378 ((T)2.0*q.x*q.y + (T)2.0*q.s*q.z)*v.y + 01379 ((T)2.0*q.x*q.z - (T)2.0*q.s*q.y)*v.z; 01380 01381 vect.y = ((T)2.0*q.x*q.y - (T)2.0*q.s*q.z)*v.x + 01382 (q.s*q.s - q.x*q.x + q.y*q.y - q.z*q.z)*v.y + 01383 ((T)2.0*q.y*q.z + (T)2.0*q.s*q.x)*v.z; 01384 01385 vect.z = ((T)2.0*q.x*q.z + (T)2.0*q.s*q.y)*v.x + 01386 ((T)2.0*q.y*q.z - (T)2.0*q.s*q.x)*v.y + 01387 (q.s*q.s - q.x*q.x - q.y*q.y + q.z*q.z)*v.z; 01388 01389 return vect; 01390 }
T* jbxl::VectorRotation | ( | T * | v, | |
Quaternion< T > | q | |||
) | [inline] |
Definition at line 1394 of file Rotation.h.
References Quaternion< T >::s, Quaternion< T >::x, Quaternion< T >::y, and Quaternion< T >::z.
01395 { 01396 T x, y, z; 01397 01398 x = (q.s*q.s + q.x*q.x - q.y*q.y -q.z*q.z)*v[0] + 01399 ((T)2.0*q.x*q.y - (T)2.0*q.s*q.z)*v[1] + 01400 ((T)2.0*q.x*q.z + (T)2.0*q.s*q.y)*v[2]; 01401 01402 y = ((T)2.0*q.x*q.y + (T)2.0*q.s*q.z)*v[0] + 01403 (q.s*q.s - q.x*q.x + q.y*q.y - q.z*q.z)*v[1] + 01404 ((T)2.0*q.y*q.z - (T)2.0*q.s*q.x)*v[2]; 01405 01406 z = ((T)2.0*q.x*q.z - (T)2.0*q.s*q.y)*v[0] + 01407 ((T)2.0*q.y*q.z + (T)2.0*q.s*q.x)*v[1] + 01408 (q.s*q.s - q.x*q.x - q.y*q.y + q.z*q.z)*v[2]; 01409 01410 v[0] = x; 01411 v[1] = y; 01412 v[2] = z; 01413 01414 return v; 01415 }
Vector<T> jbxl::VectorRotation | ( | Vector< T > | v, | |
Quaternion< T > | q | |||
) | [inline] |
ベクトル回転の高速計算
Definition at line 1352 of file Rotation.h.
References Quaternion< T >::s, Quaternion< T >::x, Vector< T >::x, Vector< T >::y, Quaternion< T >::y, Vector< T >::z, and Quaternion< T >::z.
Referenced by TriPolyData::execRotate(), FacetBaseData::execRotate(), and AffineTrans< double >::execRotate().
01353 { 01354 Vector<T> vect; 01355 01356 vect.x = (q.s*q.s + q.x*q.x - q.y*q.y -q.z*q.z)*v.x + 01357 ((T)2.0*q.x*q.y - (T)2.0*q.s*q.z)*v.y + 01358 ((T)2.0*q.x*q.z + (T)2.0*q.s*q.y)*v.z; 01359 01360 vect.y = ((T)2.0*q.x*q.y + (T)2.0*q.s*q.z)*v.x + 01361 (q.s*q.s - q.x*q.x + q.y*q.y - q.z*q.z)*v.y + 01362 ((T)2.0*q.y*q.z - (T)2.0*q.s*q.x)*v.z; 01363 01364 vect.z = ((T)2.0*q.x*q.z - (T)2.0*q.s*q.y)*v.x + 01365 ((T)2.0*q.y*q.z + (T)2.0*q.s*q.x)*v.y + 01366 (q.s*q.s - q.x*q.x - q.y*q.y + q.z*q.z)*v.z; 01367 01368 return vect; 01369 }
DllExport TVector< double > Vertex2TVector | ( | BREP_VERTEX * | v | ) |
Definition at line 1088 of file Brep.cpp.
References Vector< T >::n, BREP_VERTEX::point, TVector< T >::t, BREP_VERTEX::tolerance, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Referenced by CollisionTriContour2D(), CollisionTriContour3D(), BREP_CONTOUR::ComputeDirectRS(), IsAtLine(), IsInTriangle(), and SamePlaneContour().
01089 { 01090 TVector<double> tv; 01091 01092 tv.x = v->point.x; 01093 tv.y = v->point.y; 01094 tv.z = v->point.z; 01095 tv.n = sqrt(tv.x*tv.x + tv.y*tv.y + tv.z*tv.z); 01096 tv.t = v->tolerance; 01097 01098 return tv; 01099 }
template <typename R, typename T> MSGraph<Vector<R> > vNabla(MSGraph<T> vp)
グラフィックデータの ナブラを計算する(Sobel).
vp | 計算対象となるグラフィックデータ構造体. |
Definition at line 647 of file Gmt.h.
References MSGraph< T >::base, DEBUG_MODE, MSGraph< T >::free(), MSGraph< T >::gp, MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, PRINT_MESG, MSGraph< T >::rbound, MSGraph< T >::RZxy, MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00648 { 00649 int i; 00650 MSGraph<R> px, py, pz; 00651 MSGraph<Vector<R> > nv; 00652 00653 //MSGraph<Vector<R> > nv(vp.xs, vp.ys, vp.zs); 00654 nv.xs = vp.xs; 00655 nv.ys = vp.ys; 00656 nv.zs = vp.zs; 00657 nv.zero.set(vp.zero, vp.zero, vp.zero); 00658 nv.base.set(vp.base, vp.base, vp.base); 00659 nv.RZxy = vp.RZxy; 00660 nv.rbound = vp.rbound; 00661 00662 nv.gp = (Vector<R>*)malloc(sizeof(Vector<R>)*nv.xs*nv.ys*nv.zs); 00663 if (nv.isNull()) { 00664 DEBUG_MODE PRINT_MESG("vNabla: No More Memory!!\n"); 00665 nv.state = JBXL_GRAPH_MEMORY_ERROR; 00666 return nv; 00667 } 00668 for (i=0; i<vp.xs*vp.ys*vp.zs; i++) { 00669 nv.gp[i] = nv.base; 00670 } 00671 00672 px = xSobel<R>(vp); 00673 if (px.gp==NULL) { 00674 nv.state = px.state; 00675 return nv; 00676 } 00677 00678 py = ySobel<R>(vp); 00679 if (py.gp==NULL) { 00680 px.free(); 00681 nv.state = py.state; 00682 return nv; 00683 } 00684 00685 pz = zSobel<R>(vp); // 2Dなら 0が入る 00686 if (pz.gp==NULL) { 00687 px.free(); 00688 py.free(); 00689 nv.state = pz.state; 00690 return nv; 00691 } 00692 00693 for (i=0; i<vp.xs*vp.ys*vp.zs; i++) { 00694 (nv.gp[i])->set_Vector(px.gp[i], py.gp[i], pz.gp[i]); 00695 } 00696 00697 px.free(); 00698 py.free(); 00699 pz.free(); 00700 00701 return nv; 00702 }
Quaternion<T> jbxl::VPPQuaternion | ( | Vector< T > | a, | |
Vector< T > | b, | |||
Vector< T > | c | |||
) | [inline] |
Definition at line 1502 of file Rotation.h.
References Vector< T >::c.
void jbxl::wCircle3D | ( | MSGraph< T > | vp, | |
Vector< double > | ox, | |||
Vector< double > | ex, | |||
double | rr, | |||
int | cc, | |||
int | mode | |||
) | [inline] |
Definition at line 182 of file Window.h.
References Max, MSGraph_Circle3D(), MSGraph< T >::wRateX, MSGraph< T >::wRateY, MSGraph< T >::wRateZ, MSGraph< T >::wZeroX, MSGraph< T >::wZeroY, MSGraph< T >::wZeroZ, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
00183 { 00184 double rate = Max(vp.wRateX, vp.wRateY); 00185 rate = Max(rate, vp.wRateZ); 00186 int r = (int)(rr*rate); 00187 00188 ox.x = (vp.wZeroX - ox.x)*vp.wRateX; 00189 ox.y = (ox.y - vp.wZeroY)*vp.wRateY; 00190 ox.z = (vp.wZeroZ - ox.z)*vp.wRateZ; 00191 00192 ex.x = -ex.x*vp.wRateX; 00193 ex.y = ex.y*vp.wRateY; 00194 ex.z = -ex.z*vp.wRateZ; 00195 00196 MSGraph_Circle3D(vp, ox, ex, r, cc, mode); 00197 }
void jbxl::wDraw | ( | MSGraph< T > * | vp, | |
double | x, | |||
double | y, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> void wDraw(MSGraph<T>* vp, double x, double y, int cc)
ワールド座標系で現地点から指定した地点へ線を引く.指定した地点が現地点となる.
vp | 操作対象のグラフィックデータ. | |
x | 線の終点の x座標(ワールド座標系). | |
y | 線の終点の y座標(ワールド座標系). | |
cc | 線の輝度値. |
Definition at line 211 of file Window.h.
References MSGraph< T >::wNowX.
void jbxl::wDraw3D | ( | MSGraph< T > * | vp, | |
double | x, | |||
double | y, | |||
double | z, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> void wDraw3D(MSGraph<T>* vp, double x, double y, double z, int cc)
3次元のワールド座標系で現地点から指定した地点へ線を引く.指定した地点が現地点となる.
vp | 操作対象のグラフィックデータ. | |
x | 線の終点の x座標(ワールド座標系). | |
y | 線の終点の y座標(ワールド座標系). | |
z | 線の終点の z座標(ワールド座標系). | |
cc | 線の輝度値. |
Definition at line 230 of file Window.h.
References MSGraph< T >::wNowX.
void jbxl::wDraw_rel | ( | MSGraph< T > * | vp, | |
double | x, | |||
double | y, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> void wDraw_rel(MSGraph<T>* vp, double x, double y, int cc)
ワールド座標系で現地点を起点として相対的に線を引く.線の終点が現地点となる.
vp | 操作対象のグラフィックデータ. | |
x | 現地点から x方向への移動距離(ワールド座標系). | |
y | 現地点から y方向への移動距離(ワールド座標系). | |
cc | 線の輝度値. |
Definition at line 248 of file Window.h.
References MSGraph< T >::wNowX, and MSGraph< T >::wNowY.
void jbxl::wDraw_rel3D | ( | MSGraph< T > * | vp, | |
double | x, | |||
double | y, | |||
double | z, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> void wDraw_rel3D(MSGraph<T>* vp, double x, double y, double z, int cc)
3次元のワールド座標系で現地点を起点として相対的に線を引く.線の終点が現地点となる.
vp | 操作対象のグラフィックデータ. | |
x | 現地点から x方向への移動距離(ワールド座標系). | |
y | 現地点から y方向への移動距離(ワールド座標系). | |
z | 現地点から z方向への移動距離(ワールド座標系). | |
cc | 線の輝度値. |
Definition at line 270 of file Window.h.
References MSGraph< T >::wNowX, MSGraph< T >::wNowY, and MSGraph< T >::wNowZ.
T jbxl::wGetPixel | ( | MSGraph< T > | vp, | |
double | x, | |||
double | y | |||
) | [inline] |
template <typename t>=""> T wGetPixel(MSGraph<T> vp, double x, double y)
ワールド座標系の点のデータを得る.
vp | 操作対象のグラフィックデータ. | |
x | 点の x座標(ワールド座標系). | |
y | 点の y座標(ワールド座標系). |
Definition at line 93 of file Window.h.
References MSGraph< T >::point(), MSGraph< T >::wRateX, MSGraph< T >::wRateY, MSGraph< T >::wZeroX, MSGraph< T >::wZeroY, MSGraph< T >::ys, and MSGraph< T >::zero.
00094 { 00095 int i = (int)((x - vp.wZeroX)*vp.wRateX); 00096 int j = (int)((vp.wZeroY - y)*vp.wRateY); 00097 00098 if (i>=0 && i<vp.xs && j>=0 && j<vp.ys) return vp.point(i, j); 00099 else return vp.zero; 00100 }
T jbxl::wGetPixel3D | ( | MSGraph< T > | vp, | |
double | x, | |||
double | y, | |||
double | z | |||
) | [inline] |
template <typename t>=""> T wGetPixel3D(MSGraph<T> vp, double x, double y, double z)
3次元のワールド座標系の点のデータを得る.
vp | 操作対象のグラフィックデータ. | |
x | 点の x座標(ワールド座標系). | |
y | 点の y座標(ワールド座標系). | |
z | 点の z座標(ワールド座標系). |
Definition at line 114 of file Window.h.
References MSGraph< T >::point(), MSGraph< T >::wRateX, MSGraph< T >::wRateY, MSGraph< T >::wRateZ, MSGraph< T >::wZeroX, MSGraph< T >::wZeroY, MSGraph< T >::wZeroZ, MSGraph< T >::zero, and MSGraph< T >::zs.
00115 { 00116 int i = (int)((vp.wZeroX - x)*vp.wRateX); 00117 int j = (int)((y - vp.wZeroY)*vp.wRateY); 00118 int k = (int)((vp.wZeroZ - z)*vp.wRateZ); 00119 00120 if (i>=0 && i<vp.xs && j>=0 && j<vp.ys && k>=0 && k<vp.zs) return vp.point(i, j, k); 00121 else return vp.zero; 00122 }
void jbxl::wLine | ( | MSGraph< T > | vp, | |
double | x1, | |||
double | y1, | |||
double | x2, | |||
double | y2, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> void wLine(MSGraph<T> vp, double x1, double y1, double x2, double y2, int cc)
ワールド座標系に線を引く.
vp | 操作対象のグラフィックデータ. | |
x1 | 線の始点の x座標(ワールド座標系). | |
y1 | 線の始点の y座標(ワールド座標系). | |
x2 | 線の終点の x座標(ワールド座標系). | |
y2 | 線の終点の y座標(ワールド座標系). | |
cc | 線の輝度値. |
Definition at line 138 of file Window.h.
References MSGraph< T >::wRateX, MSGraph< T >::wRateY, MSGraph< T >::wZeroX, and MSGraph< T >::wZeroY.
void jbxl::wLine3D | ( | MSGraph< T > | vp, | |
double | x1, | |||
double | y1, | |||
double | z1, | |||
double | x2, | |||
double | y2, | |||
double | z2, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> void wLine3D(MSGraph<T> vp, double x1, double y1, double z1, double x2, double y2, double z2, int cc)
3次元のワールド座標系に線を引く.
vp | 操作対象のグラフィックデータ. | |
x1 | 線の始点の x座標(ワールド座標系). | |
y1 | 線の始点の y座標(ワールド座標系). | |
z1 | 線の始点の z座標(ワールド座標系). | |
x2 | 線の終点の x座標(ワールド座標系). | |
y2 | 線の終点の y座標(ワールド座標系). | |
z2 | 線の終点の z座標(ワールド座標系). | |
cc | 線の輝度値. |
Definition at line 166 of file Window.h.
References MSGraph< T >::wRateX, MSGraph< T >::wRateY, MSGraph< T >::wRateZ, MSGraph< T >::wZeroX, MSGraph< T >::wZeroY, and MSGraph< T >::wZeroZ.
00167 { 00168 int i1, j1, k1, i2, j2, k2; 00169 00170 i1 = (int)((vp.wZeroX - x1)*vp.wRateX); 00171 i2 = (int)((vp.wZeroX - x2)*vp.wRateX); 00172 j1 = (int)((y1 - vp.wZeroY)*vp.wRateY); 00173 j2 = (int)((y2 - vp.wZeroY)*vp.wRateY); 00174 k1 = (int)((vp.wZeroZ - z1)*vp.wRateZ); 00175 k2 = (int)((vp.wZeroZ - z2)*vp.wRateZ); 00176 00177 MSGraph_Line3D<T>(vp, i1, j1, k1, i2, j2, k2, cc); 00178 }
int writeCmnHeadData | ( | FILE * | fp, | |
CmnHead * | hd, | |||
bool | cnt = false | |||
) |
int jbxl::writeCmnHeadData(File* fp, CmnHead* hd, bool cnt)
共通画像データをファイルとして保存する.
元の共通画像データのヘッダ種別が MOON_DATA または USERSET_DATAの場合は CT(MOON)形式で保存する.
RAS_DATA, JPEG_RGB_DATA, JPEG_MONO_DATA, TIFF_DATAの場合はそれぞれの形式で保存する.(TIFF_DATAは未サポート)
CT_DATA, CT_3DM, CT_3D_VOL 場合はそのまま共通形式(ヘッダ種別はそのまま)で保存する.
カウンタサポートあり.
サポートしているヘッダ種別は
CT_DATA, USERSET_DATA, CT_3DM, CT_3D_VOL, RAS_DATA, MOON_DATA, JPEG_RGB_DATA, JPEG_MONO_DATA
ヘッダに必要な情報は
hd->kind, xsize, ysize, zsize, depth, grptr, (buf) ( )は省略可.
fp | 保存するファイルの識別子. | |
hd | 保存するデータを既述した共通ヘッダ. | |
cnt | 仮想カウンタを使用するか? |
>0 | 書き込んだサイズ. | |
JBXL_GRAPH_HEADER_ERROR | ヘッダエラー | |
JBXL_GRAPH_MEMORY_ERROR | メモリエラー | |
JBXL_GRAPH_CANCEL | キャンセル |
Definition at line 1519 of file Gio.cpp.
References CTHead::anydata, CmnHead::bsize, CmnHead::buf, CT_3D_VOL, CT_3DM, CT_DATA, CTHead::ctmax, CTHead::ctmin, CTHead::cutdown, CTHead::cutleft, CTHead::cutright, CTHead::cutup, CmnHead::depth, GetUsableGlobalCounter(), CmnHead::grptr, hton_ar, hton_st, CVCounter::isCanceled(), JBXL_GRAPH_CANCEL, JBXL_GRAPH_HEADER_ERROR, JBXL_GRAPH_MEMORY_ERROR, JPEG16_ARGB_DATA, JPEG16_RGB_DATA, JPEG16_RGBA_DATA, JPEG_ARGB_DATA, JPEG_MONO_DATA, JPEG_RGB_DATA, JPEG_RGBA_DATA, CmnHead::kind, CmnHead::lsize, MOON_DATA, PRINT_MESG, CVCounter::PutFill(), RAS_DATA, CVCounter::SetMax(), CVCounter::SetPos(), CVCounter::StepIt(), TempBase, UN_KNOWN_DATA, USERSET_DATA, writeRasData(), CTHead::xsize, CmnHead::xsize, CTHead::ysize, CmnHead::ysize, and CmnHead::zsize.
Referenced by writeCmnHeadFile().
01520 { 01521 CTHead chd; 01522 CmnHead cmd; 01523 CVCounter* counter = NULL; 01524 sByte* ptr; 01525 int i, j, k, l; 01526 int csize, psize; 01527 int kind = hd->kind & 0x00ff; 01528 01529 if (kind==UN_KNOWN_DATA) return JBXL_GRAPH_HEADER_ERROR; 01530 01531 // SUN RASTER 01532 if (kind==RAS_DATA) { 01533 //csize = writeRasData(fp, hd, hd->depth); 01534 csize = writeRasData(fp, hd, 8); 01535 return csize; 01536 } 01537 01538 #ifdef ENABLE_JPEGLIB 01539 // JPEG 01540 if (kind==JPEG_RGB_DATA || kind==JPEG_MONO_DATA || kind==JPEG_ARGB_DATA || kind==JPEG_RGBA_DATA || 01541 kind==JPEG16_RGB_DATA || kind==JPEG16_ARGB_DATA || kind==JPEG16_RGBA_DATA) { 01542 JPEGImage jpg = CmnHead2JPEGImage(*hd); 01543 csize = writeJPEGData(fp, jpg, 100); 01544 jpg.free(); 01545 return csize; 01546 } 01547 #endif 01548 01549 // TIFF 01550 /*if (kind==TIFF_DATA) { 01551 csize = 01552 return csize; 01553 }*/ 01554 01556 // CT : ヘッダの準備 01557 if (hd->zsize<=0) hd->zsize = 1; 01558 if (hd->depth<=0) hd->depth = 16; 01559 01560 psize = hd->xsize*hd->ysize*((hd->depth+7)/8); 01561 hd->lsize = psize*hd->zsize; 01562 ptr = (sByte*)malloc(hd->lsize); 01563 if (ptr==NULL) return JBXL_GRAPH_MEMORY_ERROR; 01564 01565 // CTHead chd を作る. 01566 if (kind==CT_DATA || kind==CT_3DM || kind==CT_3D_VOL) { 01567 PRINT_MESG("writeCmnHeadData: CTデータ\n"); 01568 PRINT_MESG("writeCmnHeadData: ヘッダバッファ bsize = %d\n", hd->bsize); 01569 PRINT_MESG("writeCmnHeadData: データサイズ lsize = %d\n", hd->lsize); 01570 PRINT_MESG("writeCmnHeadData: サイズ %dx%dx%d %d\n", hd->xsize, hd->ysize, hd->zsize, hd->depth); 01571 01572 memcpy(&chd, hd->buf, hd->bsize); 01573 chd.anydata[2] += TempBase; 01574 hton_st(&chd, 2); 01575 01576 memcpy(ptr, hd->grptr, hd->lsize); 01577 } 01578 else if (kind==MOON_DATA || kind==USERSET_DATA) { 01579 chd.xsize = htons((sWord)hd->xsize); 01580 chd.ysize = htons((sWord)hd->ysize); 01581 chd.ctmin = 0; 01582 chd.ctmax = 0; 01583 chd.cutup = 0; 01584 chd.cutdown = 0; 01585 chd.cutleft = 0; 01586 chd.cutright= 0; 01587 01588 k = l = 0; 01589 if (hd->depth<16){ 01590 for (i=0; i<hd->xsize*hd->ysize; i++) { 01591 for (j=0; j<hd->depth/8; j++) ptr[k++] = 0x00; 01592 for (j=hd->depth/8; j<2; j++) ptr[k++] = hd->grptr[l++]; 01593 } 01594 } 01595 else if (hd->depth==16) { 01596 for (i=0; i<hd->xsize*hd->ysize; i++) { 01597 for (j=0; j<2; j++) ptr[k++] = hd->grptr[l++]; 01598 } 01599 } 01600 else { 01601 for (i=0; i<hd->xsize*hd->ysize; i++) { 01602 for (j=0; j<2; j++) ptr[k++] = hd->grptr[l++]; 01603 l += (hd->depth)/8 - 2; 01604 } 01605 } 01606 } 01607 else { 01608 PRINT_MESG("writeCmnHeadData: サポートしていないヘッダタイプ %d\n", hd->kind); 01609 free(ptr); 01610 return 0; 01611 } 01612 01614 // データ書き込み 01615 csize = 0; 01616 // 共通ヘッダ書き込み 01617 if (kind==CT_DATA || kind==CT_3DM || kind==CT_3D_VOL) { 01618 // カウンタ 01619 if (hd->zsize>=10 && cnt) { 01620 counter = GetUsableGlobalCounter(); 01621 if (counter!=NULL) { 01622 //counter->SetTitle("Commonファイル書き込み中"); 01623 counter->SetMax((hd->zsize+1)/10); 01624 counter->SetPos(1); 01625 } 01626 } 01627 01628 cmd = *hd; 01629 cmd.grptr = NULL; 01630 hton_st(&cmd, 4); 01631 csize = sizeof(CmnHead); 01632 fwrite(&cmd, csize, 1, fp); 01633 } 01634 01635 // CTヘッダ書き込み 01636 fwrite(&chd, sizeof(CTHead), 1, fp); 01637 csize += sizeof(CTHead); 01638 01639 // 本体データ書き込み 01640 hton_ar((sWord*)ptr, hd->lsize); 01641 01642 if (counter==NULL) { 01643 fwrite(ptr, hd->lsize, 1, fp); 01644 csize += hd->lsize; 01645 } 01646 else { 01647 for (i=0; i<hd->zsize; i++) { 01648 fseek(fp, csize, 0); 01649 fwrite(ptr+i*psize, psize, 1, fp); 01650 csize += psize; 01651 if (i%10==0) { 01652 counter->StepIt(); 01653 if (counter->isCanceled()) { // キャンセル 01654 free(ptr); 01655 return JBXL_GRAPH_CANCEL; 01656 } 01657 } 01658 } 01659 } 01660 01661 free(ptr); 01662 if (counter!=NULL) counter->PutFill(); 01663 01664 return csize; 01665 }
int writeCmnHeadFile | ( | const char * | fn, | |
CmnHead * | hd, | |||
bool | cnt = false | |||
) |
int jbxl::writeCmnHeadFile(const char* fn, CmnHead* hd, bool cnt)
共通画像データをCTファイルとして保存する.
元の共通画像データのヘッダ種別が MOON_DATA または USERSET_DATAの場合は CT(MOON)形式で保存する.
RAS_DATA, JPEG_RGB_DATA, JPEG_MONO_DATA, TIFF_DATAの場合はそれぞれの形式で保存する.(TIFF_DATAは未サポート)
CT_DATA, CT_3DM, CT_3D_VOL 場合はそのまま共通形式 (ヘッダはそのまま)で保存する.
サポートしているヘッダ種別は
CT_DATA, USERSET_DATA, CT_3DM, CT_3D_VOL, RAS_DATA, MOON_DATA, JPEG_RGB_DATA, JPEG_MONO_DATA, JPEG16_XXX_DATA
ヘッダに必要な情報は hd->kind, xsize, ysize, zsize, depth, grptr, (buf) ( )は省略可.
fn | 保存するファイル名. | |
hd | 保存するデータを既述した共通ヘッダ. | |
cnt | 仮想カウンタを使用するか? |
>0 | 書き込んだサイズ. | |
JBXL_GRAPH_IVDARG_ERROR | 引数不正. | |
JBXL_GRAPH_MEMORY_ERROR | メモリエラー. | |
JBXL_GRAPH_OPFILE_ERROR | ファイルオープンエラー. | |
JBXL_GRAPH_WRFILE_ERROR | 書き込みファイルサイズ不一致 | |
JBXL_GRAPH_RDFILE_ERROR | 書き込みファイルの再読み取り不可 | |
JBXL_GRAPH_HEADER_ERROR | 書き込みファイルのヘッダ異常 |
Definition at line 1431 of file Gio.cpp.
References CmnHead::bsize, CmnHead::depth, file_size(), JBXL_GRAPH_HEADER_ERROR, JBXL_GRAPH_IVDARG_ERROR, JBXL_GRAPH_OPFILE_ERROR, JBXL_GRAPH_RDFILE_ERROR, JBXL_GRAPH_WRFILE_ERROR, JPEG16_ARGB_DATA, JPEG16_RGB_DATA, JPEG16_RGBA_DATA, JPEG_ARGB_DATA, JPEG_MONO_DATA, JPEG_RGB_DATA, JPEG_RGBA_DATA, CmnHead::kind, CmnHead::lsize, MOON_DATA, ntoh_st, PRINT_MESG, RAS_DATA, UN_KNOWN_DATA, writeCmnHeadData(), CmnHead::xsize, CmnHead::ysize, and CmnHead::zsize.
Referenced by writeGraphicFile().
01432 { 01433 CmnHead cmd; 01434 FILE* fp; 01435 int csize, psize; 01436 int kind = hd->kind & 0x0ff; 01437 01438 if (kind==UN_KNOWN_DATA) return JBXL_GRAPH_HEADER_ERROR; 01439 if (hd==NULL || hd->lsize==0) return JBXL_GRAPH_IVDARG_ERROR; 01440 01441 if ((fp=fopen(fn,"wb"))==NULL) { 01442 PRINT_MESG("WRITECMNHEADFILE: エラー:ファイルオープン失敗\n"); 01443 return JBXL_GRAPH_OPFILE_ERROR; 01444 } 01445 PRINT_MESG("writeCmnHeadFile: ファイル種別 = %d で書き込み中.%dx%dx%d\n", hd->kind, hd->xsize, hd->ysize, hd->zsize); 01446 01447 // Write File 01448 csize = writeCmnHeadData(fp, hd, cnt); 01449 fclose(fp); 01450 if (csize<0) return (int)csize; 01451 01452 // SUN RASTER 01453 if (kind==RAS_DATA) return csize; 01454 01455 // JPEG 01456 if (kind==JPEG_RGB_DATA || kind==JPEG_MONO_DATA) return csize; 01457 if (kind==JPEG_ARGB_DATA || kind==JPEG_RGBA_DATA) return csize; 01458 if (kind==JPEG16_RGB_DATA || kind==JPEG16_ARGB_DATA || kind==JPEG16_RGBA_DATA) return csize; 01459 01460 // TIFF 01461 //if (kind==TIFF_DATA) return csize; 01462 01463 // 書き込みチェック 01464 int fsz = (int)file_size(fn); 01465 if (kind==MOON_DATA) psize = hd->bsize+hd->lsize; 01466 else psize = sizeof(CmnHead)+hd->bsize+hd->lsize; 01467 01468 if (fsz!=psize) { 01469 PRINT_MESG("WRITECMNHEADFILE: エラー:書き込みファイルのサイズが合わない %d != %d\n", psize, fsz); 01470 return JBXL_GRAPH_WRFILE_ERROR; 01471 } 01472 if (kind==MOON_DATA) return psize; 01473 01474 if ((fp=fopen(fn,"rb"))==NULL) { 01475 PRINT_MESG("WRITECMNHEADFILE: エラー:ファイル検査:再オープン失敗\n"); 01476 return JBXL_GRAPH_RDFILE_ERROR; 01477 } 01478 01479 fread((sByte*)&cmd, sizeof(CmnHead), 1, fp); 01480 ntoh_st(&cmd, 4); 01481 if (cmd.xsize!=hd->xsize || cmd.ysize!=hd->ysize || cmd.zsize!=hd->zsize || 01482 cmd.bsize!=hd->bsize || cmd.lsize!=hd->lsize || cmd.depth!=hd->depth || cmd.kind!=hd->kind) { 01483 PRINT_MESG("WRITECMNHEADFILE: エラー:ファイルヘッダ検査:ヘッダ異常\n"); 01484 fclose(fp); 01485 return JBXL_GRAPH_HEADER_ERROR; 01486 } 01487 01488 fclose(fp); 01489 return csize; 01490 }
int jbxl::writeGraphicFile | ( | const char * | fname, | |
MSGraph< T > | vp, | |||
int | kind = 0 , |
|||
int | mlt = FALSE , |
|||
int | fnum = 0 , |
|||
int | tnum = 0 , |
|||
bool | cnt = false | |||
) | [inline] |
template <typename t>=""> int writeGraphicFile(const char *fname, MSGraph<T> vp, int kind=0, int mlt=FALSE, int fnum=0, int tnum=0, bool cnt=false)
グラフィックデータvpをファイルとして書き出す.
kind でファイルの種別を指定可能.ただし kind==0 の場合は
サポートするデータ形式
CT_DATA, CT_3DM, MOON_DATA, RAS_DATA, JPEG_RGB_DATA, JPEG_MONO_DATA
RZxy!=1.0 ならヘッダにその情報が埋め込まれる.
fnum, tnum を指定するとグラフィックデータの一部を保存できる.
fname | 保存する際のファイル名. | |
vp | 保存するグラフィックデータ. | |
kind | データ形式 + 属性ビット | |
mlt | 3Dデータとして保存しない | |
fnum | 保存するデータの始まりの Z座標.デフォルトは 0 | |
tnum | 保存するデータの終わりの Z座標.デフォルトは vp.zs-1 | |
cnt | カウンタ(プログレスバー)を表示するか? |
1以上 | 正常終了. | |
JBXL_GRAPH_OPFILE_ERROR | ファイルオープンエラー. | |
JBXL_GRAPH_MEMORY_ERROR | メモリエラー. | |
JBXL_GRAPH_WRFILE_ERROR | 書き込みファイルサイズ不一致 | |
JBXL_GRAPH_RDFILE_ERROR | 書き込みファイルの再読み取り不可 | |
JBXL_GRAPH_HEADER_ERROR | 書き込みファイルのヘッダ異常 | |
JBXL_GRAPH_CANCEL | キャンセル |
Definition at line 459 of file Gio.h.
References CTHead::anydata, MSGraph< T >::base, CmnHead::bsize, CmnHead::buf, MSGraph< T >::color, CT_3DM, CT_DATA, CTHead::ctmax, CTHead::ctmin, CTHead::cutdown, CTHead::cutleft, CTHead::cutright, CTHead::cutup, CmnHead::depth, GetUsableGlobalCounter(), MSGraph< T >::gp, GRAPH_COLOR_ARGB, GRAPH_COLOR_ARGB16, GRAPH_COLOR_RGB16, GRAPH_COLOR_RGBA, GRAPH_COLOR_RGBA16, CmnHead::grptr, HAS_BASE, HAS_RBOUND, HAS_RZXY, CVCounter::isCanceled(), JBXL_GRAPH_CANCEL, JBXL_GRAPH_OPFILE_ERROR, JPEG16_ARGB_DATA, JPEG16_RGB_DATA, JPEG16_RGBA_DATA, JPEG_ARGB_DATA, JPEG_RGB_DATA, JPEG_RGBA_DATA, CmnHead::kind, LNAME, CmnHead::lsize, CVCounter::PutFill(), MSGraph< T >::rbound, MSGraph< T >::RZxy, RZXY_RATE, CVCounter::SetMax(), CVCounter::SetPos(), snprintf, CVCounter::StepIt(), TempBase, writeCmnHeadFile(), RBound< T >::xmax, RBound< T >::xmin, MSGraph< T >::xs, CTHead::xsize, CmnHead::xsize, RBound< T >::ymax, RBound< T >::ymin, MSGraph< T >::ys, CTHead::ysize, CmnHead::ysize, RBound< T >::zmax, RBound< T >::zmin, MSGraph< T >::zs, and CmnHead::zsize.
00460 { 00461 int ret; 00462 CmnHead hd; 00463 CTHead* chd; 00464 00465 if (fnum<0) fnum = 0; 00466 else if (fnum>vp.zs-1) fnum = vp.zs - 1; 00467 if (tnum<fnum) tnum = fnum; 00468 else if (tnum>vp.zs-1) tnum = vp.zs - 1; 00469 00470 // for JPEG 00471 if ((kind&0x00ff)==JPEG_RGB_DATA) { 00472 if (vp.color==GRAPH_COLOR_ARGB) kind = (kind&0xff00) + JPEG_ARGB_DATA; 00473 else if (vp.color==GRAPH_COLOR_RGBA) kind = (kind&0xff00) + JPEG_RGBA_DATA; 00474 00475 if (vp.color==GRAPH_COLOR_RGB16) kind = (kind&0xff00) + JPEG16_RGB_DATA; 00476 else if (vp.color==GRAPH_COLOR_ARGB16) kind = (kind&0xff00) + JPEG16_ARGB_DATA; 00477 else if (vp.color==GRAPH_COLOR_RGBA16) kind = (kind&0xff00) + JPEG16_RGBA_DATA; 00478 } 00479 00480 // 00481 hd.xsize = vp.xs; 00482 hd.ysize = vp.ys; 00483 hd.zsize = tnum - fnum + 1; //vp.zs; 00484 hd.depth = sizeof(T)*8; 00485 hd.grptr = (uByte*)(vp.gp + vp.xs*vp.ys*fnum); 00486 if (kind==0) { 00487 hd.kind = CT_3DM; 00488 if (hd.zsize==1) hd.kind = CT_DATA; 00489 } 00490 else hd.kind = kind; 00491 00492 hd.lsize = hd.zsize*hd.ysize*hd.zsize*2; 00493 hd.bsize = sizeof(CTHead); 00494 hd.buf = (uByte*)malloc(hd.bsize); 00495 if (hd.buf==NULL) return JBXL_GRAPH_OPFILE_ERROR; 00496 memset(hd.buf, 0, hd.bsize); 00497 00498 chd = (CTHead*)hd.buf; 00499 chd->xsize = (sWord)vp.xs; 00500 chd->ysize = (sWord)vp.ys; 00501 chd->ctmin = (sWord)vp.rbound.zmin; 00502 chd->ctmax = (sWord)vp.rbound.zmax; 00503 chd->cutup = (sWord)vp.rbound.ymin; 00504 chd->cutdown = (sWord)vp.rbound.ymax; 00505 chd->cutleft = (sWord)vp.rbound.xmin; 00506 chd->cutright = (sWord)vp.rbound.xmax; 00507 hd.kind |= HAS_RBOUND; 00508 00509 if (vp.RZxy!=1.0) { 00510 chd->anydata[0] = (sWord)(vp.RZxy*RZXY_RATE); 00511 chd->anydata[1] = (sWord)RZXY_RATE; 00512 hd.kind |= HAS_RZXY; 00513 } 00514 00515 if (vp.base!=0) { 00516 chd->anydata[2] = (sWord)vp.base + TempBase; 00517 hd.kind |= HAS_BASE; 00518 } 00519 00520 // 通常の保存 00521 if (!mlt) { 00522 ret = writeCmnHeadFile(fname, &hd, cnt); 00523 } 00524 00525 // マルチスライス 00526 else { 00527 // カウンタ 00528 CVCounter* counter = NULL; 00529 if (hd.zsize>=10 && cnt) { 00530 counter = GetUsableGlobalCounter(); 00531 if (counter!=NULL) { 00532 counter->SetMax((hd.zsize+1)/10); 00533 counter->SetPos(1); 00534 } 00535 } 00536 00537 char filename[LNAME]; 00538 int num = hd.zsize; 00539 int cnt = fnum; 00540 hd.zsize = 1; 00541 00542 for (int i=0; i<num; i++) { 00543 snprintf(filename, LNAME-2, fname, cnt); 00544 hd.grptr = (uByte*)(vp.gp + vp.xs*vp.ys*cnt); 00545 ret = writeCmnHeadFile(filename, &hd, false); 00546 00547 if (counter!=NULL && i%10==0) { 00548 counter->StepIt(); 00549 if (counter->isCanceled()) { // キャンセル 00550 if (hd.buf!=NULL) free(hd.buf); 00551 return JBXL_GRAPH_CANCEL; 00552 } 00553 } 00554 if (ret<0) break; 00555 cnt++; 00556 } 00557 if (counter!=NULL) counter->PutFill(); 00558 } 00559 00560 if (hd.buf!=NULL) free(hd.buf); 00561 00562 return ret; 00563 }
int writeRasData | ( | FILE * | fp, | |
CmnHead * | hd, | |||
int | obit = 8 | |||
) |
int jbxl::writeRasData(FILE* fp, CmnHead* hd, int obit)
色々な画像データをSUN RASTER型式でファイルに保存する.
fp | 保存するファイルポインタ. | |
hd | 保存するデータを既述した共通ヘッダ. | |
obit | SUN RASTERの 1ピクセルのビット数(8, 24をサポート). |
>0 | 書き込んだバイト数. | |
JBXL_GRAPH_MEMORY_ERROR | メモリエラー. |
Definition at line 109 of file Gio.cpp.
References CmnHead::bsize, CmnHead::buf, CmnHead::depth, CmnHead::grptr, hton_st, JBXL_GRAPH_MEMORY_ERROR, CmnHead::kind, CmnHead::lsize, Max, RAS_DATA, RasHead::ras_depth, RasHead::ras_height, RasHead::ras_length, RAS_MAGIC, RasHead::ras_magic, RasHead::ras_maplength, RasHead::ras_maptype, RasHead::ras_type, RasHead::ras_width, RMT_NONE, RT_STANDARD, Xabs, CmnHead::xsize, and CmnHead::ysize.
Referenced by writeCmnHeadData(), and writeRasFile().
00110 { 00111 RasHead shd; 00112 int i, j, k, l, linebyte, databyte, depth, lsize; 00113 uByte null=0x00, *ptr, *buf; 00114 00115 obit = Xabs(obit); 00116 if (hd->kind == RAS_DATA) { 00117 unsigned int u; 00118 memcpy((sByte*)&shd, hd->buf, hd->bsize); 00119 ptr = (uByte*)malloc(hd->lsize); 00120 if (ptr==NULL) return JBXL_GRAPH_MEMORY_ERROR; 00121 lsize = hd->lsize; 00122 for (u=0; u<hd->lsize; u++) ptr[u] = hd->grptr[u]; 00123 } 00124 else { // CT -> RAS 00125 if (hd->depth==16) { 00126 00127 if (obit==8) depth = 8; 00128 else depth = 24; 00129 00130 lsize = hd->xsize*hd->ysize*depth/8; 00131 buf = (uByte*)malloc(lsize); 00132 if (buf==NULL) return JBXL_GRAPH_MEMORY_ERROR; 00133 00134 if (obit==8) { 00135 int max = 255; // 8bit mode での最大値 00136 uWord* wp = (uWord*)hd->grptr; 00137 for (i=0; i<hd->xsize*hd->ysize; i++) { 00138 max = Max(max, wp[i]); 00139 } 00140 for (i=0; i<hd->ysize*hd->xsize; i++) { 00141 buf[i] = 255*wp[i]/max; 00142 } 00143 } 00144 else { 00145 k = l = 0; 00146 for (i=0; i<hd->ysize*hd->xsize; i++) { 00147 buf[k++] = hd->grptr[l++]; 00148 buf[k++] = hd->grptr[l++]; 00149 buf[k++] = null; 00150 } 00151 } 00152 } 00153 else { 00154 depth = hd->depth; 00155 lsize = hd->lsize; 00156 buf = (uByte*)hd->grptr; 00157 } 00158 00159 databyte = hd->xsize*depth/8; 00160 linebyte = lsize/hd->ysize; 00161 if (linebyte%2==1) { 00162 linebyte++; 00163 lsize = linebyte*hd->ysize; 00164 } 00165 00166 shd.ras_magic = RAS_MAGIC; 00167 shd.ras_width = hd->xsize; 00168 shd.ras_height = hd->ysize; 00169 shd.ras_depth = depth; 00170 shd.ras_length = lsize; 00171 shd.ras_type = RT_STANDARD; 00172 shd.ras_maptype = RMT_NONE; 00173 shd.ras_maplength= 0; 00174 00175 ptr = (uByte*)malloc(lsize); 00176 if (ptr==NULL) { 00177 if (hd->depth==16) free(buf); 00178 return -2; 00179 } 00180 00181 k = l = 0; 00182 for (i=0 ; i<hd->ysize; i++) { 00183 for (j=0; j<databyte; j++) ptr[k++] = buf[l++]; 00184 for (j=0; j<linebyte-databyte; j++) ptr[k++] = null; 00185 } 00186 00187 if (hd->depth==16) free(buf); 00188 } 00189 00190 hton_st(&shd, 4); 00191 fwrite(&shd, sizeof(RasHead), 1, fp); 00192 fwrite(ptr, lsize, 1, fp); 00193 00194 free(ptr); 00195 return sizeof(RasHead)+lsize; 00196 }
int jbxl::writeRasFile | ( | const char * | fname, | |
MSGraph< T > | vp | |||
) | [inline] |
template <typename t>=""> int writeRasFile(const char *fname, MSGraph<T> vp)
Definition at line 569 of file Gio.h.
References copyMSGraph2CmnHead(), JBXL_GRAPH_IVDARG_ERROR, JBXL_GRAPH_OPFILE_ERROR, JBXL_NORMAL, and writeRasData().
00570 { 00571 if (fname==NULL) return JBXL_GRAPH_IVDARG_ERROR; 00572 00573 FILE* fp = fopen(fname, "wb"); 00574 if (fp==NULL) return JBXL_GRAPH_OPFILE_ERROR; 00575 00576 CmnHead hd = copyMSGraph2CmnHead(vp); 00577 writeRasData(fp, &hd); 00578 00579 fclose(fp); 00580 return JBXL_NORMAL; 00581 }
DllExport int WriteSTLFile | ( | char * | fname, | |
BREP_SOLID_LIST | solid_list, | |||
bool | ascii = false | |||
) |
DllExport int jbxl::WriteSTLFile (char* fname, BREP_SOLID_LIST solid_list, bool ascii)
STLファイルを書き込むラッパー関数.
アスキー,バイナリを指定する.デフォルトはバイナリ(ascii==false). 書き込んだファセットの数を返す.
Definition at line 93 of file STL.cpp.
References DEBUG_MODE, PRINT_MESG, WriteSTLFileA(), and WriteSTLFileB().
00094 { 00095 int nn; 00096 00097 if (ascii) nn = WriteSTLFileA(fname, solid_list); 00098 else nn = WriteSTLFileB(fname, solid_list); 00099 00100 if (nn<0) DEBUG_MODE PRINT_MESG("WriteSTLFile: ファイルオープンエラー.\n"); 00101 return nn; 00102 }
DllExport int WriteSTLFile | ( | char * | fname, | |
BREP_SOLID * | solid, | |||
bool | ascii = false | |||
) |
int jbxl::WriteSTLFile (char* fname, BREP_SOLID* solid, bool ascii)
STLファイルを書き込むラッパー関数.
アスキー,バイナリを指定する.デフォルトはバイナリ(ascii==false). 書き込んだファセットの数を返す.
Definition at line 73 of file STL.cpp.
References DEBUG_MODE, PRINT_MESG, WriteSTLFileA(), and WriteSTLFileB().
00074 { 00075 int nn; 00076 00077 if (ascii) nn = WriteSTLFileA(fname, solid); 00078 else nn = WriteSTLFileB(fname, solid); 00079 00080 if (nn<0) DEBUG_MODE PRINT_MESG("WriteSTLFile: ファイルオープンエラー.\n"); 00081 return nn; 00082 }
DllExport int WriteSTLFileA | ( | char * | fname, | |
BREP_SOLID_LIST | solid_list | |||
) |
DllExport int jbxl::WriteSTLFileA(char* fname, BREP_SOLID_LIST solid_list)
BREP_SOLID のデータをアスキー形式の STLファイルとして書き込む
Definition at line 303 of file STL.cpp.
References BREP_WING::next, BREP_VERTEX::point, BREP_WING::vertex, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
00304 { 00305 FILE* fp; 00306 int nn = 0; 00307 00308 fp = fopen(fname, "wa"); 00309 if (fp==NULL) return -1; 00310 00311 fprintf(fp, "solid %s\n", fname); 00312 00313 BREP_SOLID_LIST::iterator isolid; 00314 for (isolid=solid_list.begin(); isolid!=solid_list.end(); isolid++){ 00315 // 00316 BREP_CONTOUR_LIST::iterator icon; 00317 for (icon=(*isolid)->contours.begin(); icon!=(*isolid)->contours.end(); icon++){ 00318 fprintf(fp, "facet normal %g %g %g\n", (*icon)->normal.x, (*icon)->normal.y, (*icon)->normal.z); 00319 fprintf(fp, " outer loop\n"); 00320 00321 BREP_WING* wing = (*icon)->wing; 00322 for (int i=0; i<3; i++) { 00323 Vector<double> vect = wing->vertex->point; 00324 fprintf(fp, " vertex %g %g %g\n", vect.x, vect.y, vect.z); 00325 wing = wing->next; 00326 } 00327 fprintf(fp," endloop\n"); 00328 fprintf(fp,"endfacet\n"); 00329 nn++; 00330 } 00331 } 00332 fprintf(fp, "endsolid %s\n", fname); 00333 fclose(fp); 00334 00335 return nn; 00336 }
DllExport int WriteSTLFileA | ( | char * | fname, | |
BREP_SOLID * | solid | |||
) |
int jbxl::WriteSTLFileA(char* fname, BREP_SOLID* solid)
BREP_SOLID のデータをアスキー形式の STLファイルとして書き込む
Definition at line 223 of file STL.cpp.
References BREP_SOLID::contours, BREP_WING::next, BREP_VERTEX::point, BREP_WING::vertex, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Referenced by BrepSolidList::outputFile(), and WriteSTLFile().
00224 { 00225 FILE* fp; 00226 int nn = 0; 00227 00228 fp = fopen(fname, "w"); 00229 if (fp==NULL) return -1; 00230 00231 fprintf(fp, "solid %s\n", fname); 00232 00233 BREP_CONTOUR_LIST::iterator icon; 00234 for (icon=solid->contours.begin(); icon!=solid->contours.end(); icon++){ 00235 fprintf(fp, "facet normal %g %g %g\n", (*icon)->normal.x, (*icon)->normal.y, (*icon)->normal.z); 00236 fprintf(fp, " outer loop\n"); 00237 00238 BREP_WING* wing = (*icon)->wing; 00239 for (int i=0; i<3; i++) { 00240 Vector<double> vect = wing->vertex->point; 00241 fprintf(fp, " vertex %g %g %g\n", vect.x, vect.y, vect.z); 00242 wing = wing->next; 00243 } 00244 fprintf(fp," endloop\n"); 00245 fprintf(fp,"endfacet\n"); 00246 nn++; 00247 } 00248 fprintf(fp, "endsolid %s\n", fname); 00249 fclose(fp); 00250 00251 return nn; 00252 }
DllExport int WriteSTLFileB | ( | char * | fname, | |
BREP_SOLID_LIST | solid_list | |||
) |
DllExport int jbxl::WriteSTLFileB(char* fname, BREP_SOLID_LIST solidi_list)
BREP_SOLID のデータをバイナリ形式の STLファイルとして書き込む
Definition at line 345 of file STL.cpp.
References STLData::vect, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
00346 { 00347 FILE* fp; 00348 int fno = 0; 00349 char message[80]="STL Binary Data Program by Fumi.Iseki"; 00350 STLData stldata; 00351 00352 fp = fopen(fname, "wb"); 00353 if (fp==NULL) return -1; 00354 00355 BREP_SOLID_LIST::iterator isolid; 00356 for (isolid=solid_list.begin(); isolid!=solid_list.end(); isolid++){ 00357 fno += (int)((*isolid)->contours.size()); 00358 } 00359 fwrite(message, 80, 1, fp); 00360 fwrite(&fno, 4, 1, fp); 00361 00362 // 00363 for (isolid=solid_list.begin(); isolid!=solid_list.end(); isolid++){ 00364 // 00365 BREP_CONTOUR_LIST::iterator icon; 00366 for (icon=(*isolid)->contours.begin(); icon!=(*isolid)->contours.end(); icon++){ 00367 stldata.vect[0] = (float)(*icon)->normal.x; 00368 stldata.vect[1] = (float)(*icon)->normal.y; 00369 stldata.vect[2] = (float)(*icon)->normal.z; 00370 00371 BREP_WING* wing = (*icon)->wing; 00372 for (int i=0; i<3; i++) { 00373 Vector<double> vect = wing->vertex->point; 00374 stldata.vect[3*i+3] = (float)vect.x; 00375 stldata.vect[3*i+4] = (float)vect.y; 00376 stldata.vect[3*i+5] = (float)vect.z; 00377 wing = wing->next; 00378 } 00379 fwrite(&stldata, 50, 1, fp); 00380 } 00381 } 00382 fclose(fp); 00383 00384 return fno; 00385 }
DllExport int WriteSTLFileB | ( | char * | fname, | |
BREP_SOLID * | solid | |||
) |
int jbxl::WriteSTLFileB(char* fname, BREP_SOLID* solid)
BREP_SOLID のデータをバイナリ形式の STLファイルとして書き込む
Definition at line 261 of file STL.cpp.
References BREP_SOLID::contours, STLData::vect, Vector< T >::x, Vector< T >::y, and Vector< T >::z.
Referenced by BrepSolidList::outputFile(), and WriteSTLFile().
00262 { 00263 FILE* fp; 00264 int fno; 00265 char message[80]="STL Binary Data Program by Fumi.Iseki"; 00266 STLData stldata; 00267 00268 fp = fopen(fname, "wb"); 00269 if (fp==NULL) return -1; 00270 00271 fno = (int)solid->contours.size(); 00272 fwrite(message, 80, 1, fp); 00273 fwrite(&fno, 4, 1, fp); 00274 00275 BREP_CONTOUR_LIST::iterator icon; 00276 for (icon=solid->contours.begin(); icon!=solid->contours.end(); icon++){ 00277 stldata.vect[0] = (float)(*icon)->normal.x; 00278 stldata.vect[1] = (float)(*icon)->normal.y; 00279 stldata.vect[2] = (float)(*icon)->normal.z; 00280 00281 BREP_WING* wing = (*icon)->wing; 00282 for (int i=0; i<3; i++) { 00283 Vector<double> vect = wing->vertex->point; 00284 stldata.vect[3*i+3] = (float)vect.x; 00285 stldata.vect[3*i+4] = (float)vect.y; 00286 stldata.vect[3*i+5] = (float)vect.z; 00287 wing = wing->next; 00288 } 00289 fwrite(&stldata, 50, 1, fp); 00290 } 00291 fclose(fp); 00292 00293 return fno; 00294 }
int writeTGAData | ( | FILE * | fp, | |
TGAImage | tga | |||
) |
int jbxl::writeTGAData(FILE* fp, TGAImage tga)
tga の画像データを fpに書き出す.
fp | ファイル記述子 | |
tga | 保存する TGAデータ |
0 | 正常終了 | |
JBXL_GRAPH_OPFILE_ERROR | ファイルオープンエラー | |
JBXL_GRAPH_HEADER_ERROR | 不正ファイル(TGAファイルでない?) | |
JBXL_GRAPH_MEMORY_ERROR | メモリエラー | |
JBXL_GRAPH_NODATA_ERROR | tga にデータが無い | |
JBXL_GRAPH_IVDARG_ERROR | サポート外のチャンネル数 |
Definition at line 232 of file TgaTool.cpp.
References TGAImage::col, TGAImage::gp, TGAImage::hd, is_little_endian(), JBXL_GRAPH_IVDARG_ERROR, JBXL_GRAPH_NODATA_ERROR, JBXL_GRAPH_OPFILE_ERROR, TGA_HEADER_SIZE, TGAImage::xs, and TGAImage::ys.
Referenced by writeTGAFile().
00233 { 00234 if (fp==NULL) return JBXL_GRAPH_OPFILE_ERROR; 00235 if (tga.col<=0 || tga.col>4) return JBXL_GRAPH_IVDARG_ERROR; 00236 if (tga.gp==NULL) return JBXL_GRAPH_NODATA_ERROR; 00237 00238 // Header http://3dtech.jp/wiki/index.php?TGA画像フォーマット詳細 00239 memset(tga.hd, 0, TGA_HEADER_SIZE); 00240 if (tga.col==3 || tga.col==4) tga.hd[2] = 2; // Full Color 00241 else tga.hd[2] = 3; // Gray Scale 00242 00243 unsigned short int* size = (unsigned short int*)&(tga.hd[12]); 00244 if (is_little_endian()) { 00245 size[0] = tga.xs; 00246 size[1] = tga.ys; 00247 } 00248 else { 00249 size[0] = htons(tga.xs); 00250 size[1] = htons(tga.ys); 00251 } 00252 00253 tga.hd[16] = tga.col*8; 00254 tga.hd[17] = 0x08 | 0x20; // 0x0x8: αチャンネル深度, 0x20: Y方向:Top->Down 00255 00256 fwrite(tga.hd, TGA_HEADER_SIZE, 1, fp); 00257 00258 // Data 00259 int len = tga.xs*tga.ys*tga.col; 00260 fwrite(tga.gp, len, 1, fp); 00261 00262 return 0; 00263 }
int writeTGAFile | ( | const char * | fname, | |
TGAImage | tga | |||
) |
int jbxl::writeTGAFile(const char* fname, TGAImage tga)
tga の画像データを fnameに書き出す.
fname | ファイル名 | |
tga | 保存する TGAデータ |
0 | 正常終了 | |
JBXL_GRAPH_OPFILE_ERROR | ファイルオープンエラー | |
JBXL_GRAPH_HEADER_ERROR | 不正ファイル(TGAファイルでない?) | |
JBXL_GRAPH_MEMORY_ERROR | メモリエラー | |
JBXL_GRAPH_NODATA_ERROR | tga にデータが無い | |
JBXL_GRAPH_IVDARG_ERROR | ファイル名が NULL, or サポート外のチャンネル数 |
Definition at line 196 of file TgaTool.cpp.
References TGAImage::col, TGAImage::gp, JBXL_GRAPH_IVDARG_ERROR, JBXL_GRAPH_NODATA_ERROR, JBXL_GRAPH_OPFILE_ERROR, and writeTGAData().
00197 { 00198 FILE* fp; 00199 int ret; 00200 00201 if (fname==NULL) return JBXL_GRAPH_IVDARG_ERROR; 00202 if (tga.col<=0 || tga.col>4) return JBXL_GRAPH_IVDARG_ERROR; 00203 if (tga.gp==NULL) return JBXL_GRAPH_NODATA_ERROR; 00204 00205 fp = fopen(fname, "wb"); 00206 if (fp==NULL) { 00207 return JBXL_GRAPH_OPFILE_ERROR; 00208 } 00209 00210 ret = writeTGAData(fp, tga); 00211 fclose(fp); 00212 00213 return ret; 00214 }
void jbxl::wSetPixel | ( | MSGraph< T > | vp, | |
double | x, | |||
double | y, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> void wSetPixel(MSGraph<T> vp, double x, double y, int cc)
ワールド座標系に点を打つ.
vp | 操作対象のグラフィックデータ. | |
x | 点の x座標(ワールド座標系). | |
y | 点の y座標(ワールド座標系). | |
cc | 点の輝度値. |
Definition at line 52 of file Window.h.
References MSGraph< T >::point(), MSGraph< T >::wRateX, MSGraph< T >::wRateY, MSGraph< T >::wZeroX, MSGraph< T >::wZeroY, and MSGraph< T >::ys.
00053 { 00054 int i = (int)((x - vp.wZeroX)*vp.wRateX); 00055 int j = (int)((vp.wZeroY - y)*vp.wRateY); 00056 00057 if (i>=0 && i<vp.xs && j>=0 && j<vp.ys) vp.point(i, j) = (T)cc; 00058 }
void jbxl::wSetPixel3D | ( | MSGraph< T > | vp, | |
double | x, | |||
double | y, | |||
double | z, | |||
int | cc | |||
) | [inline] |
template <typename t>=""> void wSetPixel3D(MSGraph<T> vp, double x, double y, double z, int cc)
3次元のワールド座標系に点を打つ.
vp | 操作対象のグラフィックデータ. | |
x | 点の x座標(ワールド座標系). | |
y | 点の y座標(ワールド座標系). | |
z | 点の z座標(ワールド座標系). | |
cc | 点の輝度値. |
Definition at line 73 of file Window.h.
References MSGraph< T >::point(), MSGraph< T >::wRateX, MSGraph< T >::wRateY, MSGraph< T >::wRateZ, MSGraph< T >::wZeroX, MSGraph< T >::wZeroY, MSGraph< T >::wZeroZ, and MSGraph< T >::zs.
00074 { 00075 int i = (int)((vp.wZeroX - x)*vp.wRateX); 00076 int j = (int)((y - vp.wZeroY)*vp.wRateY); 00077 int k = (int)((vp.wZeroZ - z)*vp.wRateZ); 00078 00079 if (i>=0 && i<vp.xs && j>=0 && j<vp.ys && k>=0 && k<vp.zs) vp.point(i, j, k) = (T)cc; 00080 }
MSGraph<T> jbxl::x_reverse_MSGraph | ( | MSGraph< T > | vp, | |
bool | ecnt = false | |||
) | [inline] |
template <typename t>=""> MSGraph<T> x_reverse_MSGraph(MSGraph<T> vp, bool ecnt=false)
グラフィックデータの x軸を反転させる.
vp | 操作対象となるグラフィックデータ構造体. | |
ecnt | 仮想カウンタを使用するか? |
Definition at line 2015 of file Graph.h.
References MSGraph< T >::base, MSGraph< T >::color, GetUsableGlobalCounter(), MSGraph< T >::gp, MSGraph< T >::init(), CVCounter::isCanceled(), MSGraph< T >::isNull(), JBXL_GRAPH_CANCEL, MSGraph< T >::RZxy, MSGraph< T >::set(), CVCounter::SetMax(), MSGraph< T >::state, CVCounter::StepIt(), MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
02016 { 02017 int i, j, k, cy, cz; 02018 MSGraph<T> wp; 02019 CVCounter* counter = NULL; 02020 02021 wp.init(); 02022 02023 if (ecnt) counter = GetUsableGlobalCounter(); 02024 if (counter!=NULL) { 02025 if (counter->isCanceled()) { 02026 wp.state = JBXL_GRAPH_CANCEL; 02027 return wp; 02028 } 02029 counter->SetMax(vp.zs); 02030 } 02031 02032 wp.set(vp.xs, vp.ys, vp.zs, vp.zero, vp.base, vp.RZxy); 02033 if (wp.isNull()) return wp; 02034 wp.color = vp.color; 02035 02036 for (k=0; k<vp.zs; k++) { 02037 cz = k*vp.xs*vp.ys; 02038 for (j=0; j<vp.ys; j++) { 02039 cy = cz + j*vp.xs; 02040 for (i=0; i<vp.xs; i++) { 02041 wp.gp[cy + i] = vp.gp[cy + vp.xs - 1 - i]; 02042 } 02043 } 02044 02045 // Counter 02046 if (counter!=NULL) { 02047 counter->StepIt(); 02048 if (counter->isCanceled()) { 02049 wp.state = JBXL_GRAPH_CANCEL; 02050 return wp; 02051 } 02052 } 02053 } 02054 02055 return wp; 02056 }
MSGraph<R> jbxl::xSobel | ( | MSGraph< T > | vp | ) | [inline] |
template <typename R, typename T> MSGraph<R> xSobel(MSGraph<T> vp)
グラフィックデータの X方向微分(Sobel)を計算する.
vp | 計算対象となるグラフィックデータ構造体. |
Definition at line 158 of file Gmt.h.
References MSGraph< T >::base, DEBUG_MODE, GetUsableGlobalCounter(), MSGraph< T >::gp, MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, MSGraph< T >::mimicry(), PRINT_MESG, CVCounter::SetMax(), MSGraph< T >::state, CVCounter::StepIt(), MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00159 { 00160 int i, j, k; 00161 int pl, nx, ny, nz; 00162 R da, db, dc, dd, de, nr; 00163 MSGraph<R> xp; 00164 00165 xp.mimicry(vp); 00166 xp.base = xp.zero = 0; 00167 00168 if (xp.isNull()) { 00169 DEBUG_MODE PRINT_MESG("XSOBEL: No More Memory!!!\n"); 00170 xp.state = JBXL_GRAPH_MEMORY_ERROR; 00171 return xp; 00172 } 00173 00174 // カウンタ 00175 CVCounter* vcounter = NULL; 00176 if (vp.zs>2) vcounter = GetUsableGlobalCounter(); 00177 if (vcounter!=NULL) vcounter->SetMax(vp.zs); 00178 00179 pl = vp.xs*vp.ys; 00180 for (k=0; k<vp.zs; k++) { 00181 nz = k*pl; 00182 for (j=1; j<vp.ys-1; j++) { 00183 ny = nz + j*vp.xs; 00184 for (i=1; i<vp.xs-1; i++) { 00185 nx = ny + i; 00186 da = vp.gp[nx+1-vp.xs] - vp.gp[nx-1-vp.xs]; // 1/4 * (da+dc) 00187 db = vp.gp[nx+1] - vp.gp[nx-1]; // 1/2 * db 00188 dc = vp.gp[nx+1+vp.xs] - vp.gp[nx-1+vp.xs]; 00189 //da = vp.point(i+1, j-1, k) - vp.point(i-1, j-1, k); // 1/4 * (da+dc) 00190 //db = vp.point(i+1, j, k) - vp.point(i-1, j, k); // 1/2 * db 00191 //dc = vp.point(i+1, j+1, k) - vp.point(i-1, j+1, k); 00192 00193 if (k==0 || k==vp.zs-1) { 00194 dd = de = 0; 00195 nr = 8; 00196 } 00197 else { 00198 dd = vp.gp[nx+1-pl] - vp.gp[nx-1-pl]; // 1/4 * (dd+de) 00199 de = vp.gp[nx+1+pl] - vp.gp[nx-1+pl]; 00200 //dd = vp.point(i+1, j, k-1) - vp.point(i-1, j, k-1); // 1/4 * (dd+de) 00201 //de = vp.point(i+1, j, k+1) - vp.point(i-1, j, k+1); 00202 nr = 12; 00203 } 00204 00205 xp.gp[nx] = (R)((da + 2.*db + dc + dd + de)/nr); 00206 } 00207 } 00208 if (vcounter!=NULL) vcounter->StepIt(); 00209 } 00210 00211 return xp; 00212 }
MSGraph<R> jbxl::xxSobel | ( | MSGraph< T > | vp | ) | [inline] |
template<typename R, typename T> MSGraph<R> xxSobel(MSGraph<T> vp)
グラフィックデータの X方向の 2階微分(Sobel)を計算する.
vp | 計算対象となるグラフィックデータ構造体. |
Definition at line 382 of file Gmt.h.
References MSGraph< T >::base, DEBUG_MODE, GetUsableGlobalCounter(), MSGraph< T >::gp, MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, MSGraph< T >::mimicry(), PRINT_MESG, CVCounter::SetMax(), MSGraph< T >::state, CVCounter::StepIt(), MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00383 { 00384 int i, j, k; 00385 int pl, nx, ny, nz, pl2, xs, xs2; 00386 R da, db, dc, dd, de; 00387 R df, dg, dh, di, dj, dk, dl, dm, nr; 00388 MSGraph<R> xp; 00389 00390 xp.mimicry(vp); 00391 xp.base = xp.zero = 0; 00392 00393 if (xp.isNull()) { 00394 DEBUG_MODE PRINT_MESG("XXSOBEL: No More Memory!!\n"); 00395 xp.state = JBXL_GRAPH_MEMORY_ERROR; 00396 return xp; 00397 } 00398 00399 // カウンタ 00400 CVCounter* vcounter = NULL; 00401 if (vp.zs>2) vcounter = GetUsableGlobalCounter(); 00402 if (vcounter!=NULL) vcounter->SetMax(vp.zs); 00403 00404 pl = vp.xs*vp.ys; 00405 pl2 = 2*pl; 00406 xs = vp.xs; 00407 xs2 = 2*vp.xs; 00408 00409 for (k=0; k<vp.zs; k++) { 00410 nz = k*pl; 00411 for (j=2; j<vp.ys-2; j++) { 00412 ny = nz + j*vp.xs; 00413 for (i=2; i<vp.xs-2; i++) { 00414 nx = ny + i; 00415 da = vp.gp[nx+2-xs2] - 2*vp.gp[nx-xs2] + vp.gp[nx-2-xs2]; 00416 db = vp.gp[nx+2-xs ] - 2*vp.gp[nx-xs] + vp.gp[nx-2-xs]; 00417 dc = vp.gp[nx+2] - 2*vp.gp[nx] + vp.gp[nx-2]; 00418 dd = vp.gp[nx+2+xs] - 2*vp.gp[nx+xs] + vp.gp[nx-2+xs]; 00419 de = vp.gp[nx+2+xs2] - 2*vp.gp[nx+xs2] + vp.gp[nx-2+xs2]; 00420 //da = vp.point(i+2, j-2, k) - 2*vp.point(i, j-2, k) + vp.point(i-2, j-2, k); 00421 //db = vp.point(i+2, j-1, k) - 2*vp.point(i, j-1, k) + vp.point(i-2, j-1, k); 00422 //dc = vp.point(i+2, j, k) - 2*vp.point(i, j, k) + vp.point(i-2, j, k); 00423 //dd = vp.point(i+2, j+1, k) - 2*vp.point(i, j+1, k) + vp.point(i-2, j+1, k); 00424 //de = vp.point(i+2, j+2, k) - 2*vp.point(i, j+2, k) + vp.point(i-2, j+2, k); 00425 00426 if (k==0 || k==vp.zs-1) { 00427 dc = (R)(6.*dc); 00428 df = dg = dh = di = dj = dk = dl = dm = 0; 00429 nr = 64; 00430 } 00431 else { 00432 dc = (R)(8.*dc); 00433 df = vp.gp[nx+2-xs-pl] - 2*vp.gp[nx-xs-pl] + vp.gp[nx-2-xs-pl]; 00434 dg = vp.gp[nx+2 -pl] - 2*vp.gp[nx -pl] + vp.gp[nx-2 -pl]; 00435 dh = vp.gp[nx+2+xs-pl] - 2*vp.gp[nx+xs-pl] + vp.gp[nx-2+xs-pl]; 00436 di = vp.gp[nx+2-xs+pl] - 2*vp.gp[nx-xs+pl] + vp.gp[nx-2-xs+pl]; 00437 dj = vp.gp[nx+2 +pl] - 2*vp.gp[nx +pl] + vp.gp[nx-2 +pl]; 00438 dk = vp.gp[nx+2+xs+pl] - 2*vp.gp[nx+xs+pl] + vp.gp[nx-2+xs+pl]; 00439 //df = vp.point(i+2, j-1, k-1) - 2*vp.point(i, j-1, k-1) + vp.point(i-2, j-1, k-1); 00440 //dg = vp.point(i+2, j, k-1) - 2*vp.point(i, j , k-1) + vp.point(i-2, j, k-1); 00441 //dh = vp.point(i+2, j+1, k-1) - 2*vp.point(i, j+1, k-1) + vp.point(i-2, j+1, k-1); 00442 //di = vp.point(i+2, j-1, k+1) - 2*vp.point(i, j-1, k+1) + vp.point(i-2, j-1, k+1); 00443 //dj = vp.point(i+2, j, k+1) - 2*vp.point(i, j, k+1) + vp.point(i-2, j, k+1); 00444 //dk = vp.point(i+2, j+1, k+1) - 2*vp.point(i, j+1, k+1) + vp.point(i-2, j+1, k+1); 00445 00446 if (k==1 || k==vp.zs-2) { 00447 dl = dm = 0; 00448 nr = 136; 00449 } 00450 else { 00451 dl = vp.gp[nx+2-pl2] - 2*vp.gp[nx-pl2] + vp.gp[nx-2-pl2]; 00452 dm = vp.gp[nx+2+pl2] - 2*vp.gp[nx+pl2] + vp.gp[nx-2+pl2];\ 00453 //dl = vp.point(i+2, j, k-2) - 2*vp.point(i, j, k-2) + vp.point(i-2, j, k-2); 00454 //dm = vp.point(i+2, j, k+2) - 2*vp.point(i, j, k+2) + vp.point(i-2, j, k+2); 00455 nr = 144; 00456 } 00457 } 00458 xp.gp[nx] = (R)((dc + 4.*(db+dd+dg+dj) + 2.*(df+dh+di+dk) + da+de+dl+dm)/nr); 00459 } 00460 } 00461 if (vcounter!=NULL) vcounter->StepIt(); 00462 } 00463 00464 return xp; 00465 }
MSGraph<R> jbxl::ySobel | ( | MSGraph< T > | vp | ) | [inline] |
template<typename R, typename T> MSGraph<R> ySobel(MSGraph<T> vp)
グラフィックデータの Y方向微分(Sobel)を計算する.
vp | 計算対象となるグラフィックデータ構造体. |
Definition at line 223 of file Gmt.h.
References MSGraph< T >::base, DEBUG_MODE, GetUsableGlobalCounter(), MSGraph< T >::gp, MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, MSGraph< T >::mimicry(), PRINT_MESG, CVCounter::SetMax(), MSGraph< T >::state, CVCounter::StepIt(), MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00224 { 00225 int i, j, k; 00226 int pl, nx, ny, nz; 00227 R da, db, dc, dd, de, nr; 00228 MSGraph<R> xp; 00229 00230 xp.mimicry(vp); 00231 xp.base = xp.zero = 0; 00232 00233 if (xp.isNull()) { 00234 DEBUG_MODE PRINT_MESG("YSOBEL: No More Memory!!\n"); 00235 xp.state = JBXL_GRAPH_MEMORY_ERROR; 00236 return xp; 00237 } 00238 00239 // カウンタ 00240 CVCounter* vcounter = NULL; 00241 if (vp.zs>2) vcounter = GetUsableGlobalCounter(); 00242 if (vcounter!=NULL) vcounter->SetMax(vp.zs); 00243 00244 pl = vp.xs*vp.ys; 00245 for (k=0; k<vp.zs; k++) { 00246 nz = k*pl; 00247 for (j=1; j<vp.ys-1; j++) { 00248 ny = nz + j*vp.xs; 00249 for (i=1; i<vp.xs-1; i++) { 00250 nx = ny + i; 00251 da = vp.gp[nx-1+vp.xs] - vp.gp[nx-1-vp.xs]; 00252 db = vp.gp[nx +vp.xs] - vp.gp[nx -vp.xs]; 00253 dc = vp.gp[nx+1+vp.xs] - vp.gp[nx+1-vp.xs]; 00254 //da = vp.point(i-1, j+1, k) - vp.point(i-1, j-1, k); 00255 //db = vp.point(i , j+1, k) - vp.point(i, j-1, k); 00256 //dc = vp.point(i+1, j+1, k) - vp.point(i+1, j-1, k); 00257 00258 if (k==0 || k==vp.zs-1) { 00259 dd = de = 0; 00260 nr = 8; 00261 } 00262 else { 00263 dd = vp.gp[nx+vp.xs-pl] - vp.gp[nx-vp.xs-pl]; 00264 de = vp.gp[nx+vp.xs+pl] - vp.gp[nx-vp.xs+pl]; 00265 //dd = vp.point(i, j+1, k-1) - vp.point(i, j-1, k-1); 00266 //de = vp.point(i, j+1, k+1) - vp.point(i, j-1, k+1); 00267 nr = 12; 00268 } 00269 00270 xp.gp[nx] = (R)((da + 2.*db + dc + dd + de)/nr); 00271 } 00272 } 00273 if (vcounter!=NULL) vcounter->StepIt(); 00274 } 00275 00276 return xp; 00277 }
MSGraph<R> jbxl::yySobel | ( | MSGraph< T > | vp | ) | [inline] |
template<typename R, typename T> MSGraph<R> yySobel(MSGraph<T> vp)
グラフィックデータの Y方向の 2階微分(Sobel)を計算する.
vp | 計算対象となるグラフィックデータ構造体. |
Definition at line 476 of file Gmt.h.
References MSGraph< T >::base, DEBUG_MODE, GetUsableGlobalCounter(), MSGraph< T >::gp, MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, MSGraph< T >::mimicry(), PRINT_MESG, CVCounter::SetMax(), MSGraph< T >::state, CVCounter::StepIt(), MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00477 { 00478 int i, j, k; 00479 int pl, nx, ny, nz, pl2, xs, xs2; 00480 R da, db, dc, dd, de; 00481 R df, dg, dh, di, dj, dk, dl, dm, nr; 00482 MSGraph<R> xp; 00483 00484 xp.mimicry(vp); 00485 xp.base = xp.zero = 0; 00486 00487 if (xp.isNull()) { 00488 DEBUG_MODE PRINT_MESG("YYSOBEL: No More Memory!!\n"); 00489 xp.state = JBXL_GRAPH_MEMORY_ERROR; 00490 return xp; 00491 } 00492 00493 // カウンタ 00494 CVCounter* vcounter = NULL; 00495 if (vp.zs>2) vcounter = GetUsableGlobalCounter(); 00496 if (vcounter!=NULL) vcounter->SetMax(vp.zs); 00497 00498 pl = vp.xs*vp.ys; 00499 pl2 = 2*pl; 00500 xs = vp.xs; 00501 xs2 = 2*vp.xs; 00502 00503 for (k=0; k<vp.zs; k++) { 00504 nz = k*pl; 00505 for (j=2; j<vp.ys-2; j++) { 00506 ny = nz + j*vp.xs; 00507 for (i=2; i<vp.xs-2; i++) { 00508 nx = ny + i; 00509 da = vp.gp[nx-2+xs2] - 2*vp.gp[nx-2] + vp.gp[nx-2-xs2]; 00510 db = vp.gp[nx-1+xs2] - 2*vp.gp[nx-1] + vp.gp[nx-1-xs2]; 00511 dc = vp.gp[nx +xs2] - 2*vp.gp[nx] + vp.gp[nx -xs2]; 00512 dd = vp.gp[nx+1+xs2] - 2*vp.gp[nx+1] + vp.gp[nx+1-xs2]; 00513 de = vp.gp[nx+2+xs2] - 2*vp.gp[nx+2] + vp.gp[nx+2-xs2]; 00514 //da = vp.point(i-2, j+2, k) - 2*vp.point(i-2, j, k) + vp.point(i-2, j-2, k); 00515 //db = vp.point(i-1, j+2, k) - 2*vp.point(i-1, j, k) + vp.point(i-1, j-2, k); 00516 //dc = vp.point(i, j+2, k) - 2*vp.point(i, j, k) + vp.point(i, j-2, k); 00517 //dd = vp.point(i+1, j+2, k) - 2*vp.point(i+1, j, k) + vp.point(i+1, j-2, k); 00518 //de = vp.point(i+2, j+2, k) - 2*vp.point(i+2, j, k) + vp.point(i+2, j-2, k); 00519 00520 if (k==0 || k==vp.zs-1) { 00521 dc = (R)(6.*dc); 00522 df = dg = dh = di = dj = dk = dl = dm = 0; 00523 nr = 64; 00524 } 00525 else { 00526 dc = (R)(8.*dc); 00527 df = vp.gp[nx-1+xs2-pl] - 2*vp.gp[nx-1-pl] + vp.gp[nx-1-xs2-pl]; 00528 dg = vp.gp[nx +xs2-pl] - 2*vp.gp[nx -pl] + vp.gp[nx -xs2-pl]; 00529 dh = vp.gp[nx+1+xs2-pl] - 2*vp.gp[nx+1-pl] + vp.gp[nx+1-xs2-pl]; 00530 di = vp.gp[nx-1+xs2+pl] - 2*vp.gp[nx-1+pl] + vp.gp[nx-1-xs2+pl]; 00531 dj = vp.gp[nx +xs2+pl] - 2*vp.gp[nx +pl] + vp.gp[nx -xs2+pl]; 00532 dk = vp.gp[nx+1+xs2+pl] - 2*vp.gp[nx+1+pl] + vp.gp[nx+1-xs2+pl]; 00533 //df = vp.point(i-1, j+2, k-1) - 2*vp.point(i-1, j, k-1) + vp.point(i-1, j-2, k-1); 00534 //dg = vp.point(i, j+2, k-1) - 2*vp.point(i, j, k-1) + vp.point(i, j-2, k-1); 00535 //dh = vp.point(i+1, j+2, k-1) - 2*vp.point(i+1, j, k-1) + vp.point(i+1, j-2, k-1); 00536 //di = vp.point(i-1, j+2, k+1) - 2*vp.point(i-1, j, k+1) + vp.point(i-1, j-2, k+1); 00537 //dj = vp.point(i, j+2, k+1) - 2*vp.point(i, j, k+1) + vp.point(i, j-2, k+1); 00538 //dk = vp.point(i+1, j+2, k+1) - 2*vp.point(i+1, j, k+1) + vp.point(i+1, j-2, k+1); 00539 00540 if (k==1 || k==vp.zs-2) { 00541 dl = dm = 0; 00542 nr = 136; 00543 } 00544 else { 00545 dl = vp.gp[nx+xs2-pl2] - 2*vp.gp[nx-pl2] + vp.gp[nx-xs2-pl2]; 00546 dm = vp.gp[nx+xs2+pl2] - 2*vp.gp[nx+pl2] + vp.gp[nx-xs2+pl2]; 00547 //dl = vp.point(i, j+2, k-2) - 2*vp.point(i, j, k-2) + vp.point(i, j-2, k-2); 00548 //dm = vp.point(i, j+2, k+2) - 2*vp.point(i, j, k+2) + vp.point(i, j-2, k+2); 00549 nr = 144; 00550 } 00551 } 00552 xp.gp[nx] = (R)((dc + 4.*(db+dd+dg+dj) + 2.*(df+dh+di+dk) + da+de+dl+dm)/nr); 00553 } 00554 } 00555 if (vcounter!=NULL) vcounter->StepIt(); 00556 } 00557 00558 return xp; 00559 }
MSGraph<T> jbxl::zoom_MSGraph | ( | MSGraph< T > | vp, | |
double | zm, | |||
int | mode = ON | |||
) | [inline] |
template <typename t>=""> MSGraph<T> zoom_MSGraph(MSGraph<T> vp, double zm, int mode=ON)
2Dグラフィックデータ拡大する.
vp | -- 変換する Vector型単純グラフィックデータ. | |
zm | -- 倍率. | |
mode | -- モード.ON: 線形補間.その他: 単純拡大 |
Definition at line 1765 of file Graph.h.
References MSGraph< T >::color, MSGraph< T >::gp, MSGraph< T >::init(), MSGraph< T >::isNull(), JBXL_GRAPH_IVDARG_ERROR, JBXL_GRAPH_NODATA_ERROR, ON, MSGraph< T >::point(), MSGraph< T >::set(), MSGraph< T >::state, MSGraph< T >::xs, MSGraph< T >::ys, and MSGraph< T >::zs.
Referenced by count_around_MSGraph().
01766 { 01767 int xss, yss, ps, pz, py; 01768 MSGraph<T> vx; 01769 01770 vx.init(); 01771 01772 if (vp.gp==NULL) { 01773 vx.state = JBXL_GRAPH_NODATA_ERROR; 01774 return vx; 01775 } 01776 if (zm==0.0) { 01777 vx.state = JBXL_GRAPH_IVDARG_ERROR; 01778 return vx; 01779 } 01780 else if (zm<0.0) zm = -zm; 01781 01782 xss = (int)(vp.xs*zm) + 1; 01783 yss = (int)(vp.ys*zm) + 1; 01784 01785 vx.set(xss, yss, vp.zs); 01786 if (vx.isNull()) return vx; 01787 vx.color = vp.color; 01788 01789 ps = xss*yss; 01790 01791 if (mode==ON) { 01792 int ii, jj, kk, ll; 01793 double xx, yy, al, bt; 01794 01795 for(int k=0; k<vx.zs; k++) { 01796 pz = k*ps; 01797 for(int j=0; j<yss; j++) { 01798 py = pz + j*xss; 01799 for(int i=0; i<xss; i++) { 01800 xx = i/zm; 01801 yy = j/zm; 01802 ii = (int)xx; 01803 jj = (int)yy; 01804 if (ii>=vp.xs) ii = vp.xs - 1; 01805 if (jj>=vp.ys) jj = vp.ys - 1; 01806 01807 kk = ii + 1; 01808 ll = jj + 1; 01809 if (kk>=vp.xs) kk = vp.xs - 1; 01810 if (ll>=vp.ys) ll = vp.ys - 1; 01811 01812 if (xx>=0.) al = xx - ii; 01813 else al = 0.; 01814 if (yy>=0.) bt = yy - jj; 01815 else bt = 0.; 01816 01817 vx.gp[py+i] = (T)((1.-al)*(1.-bt)*vp.point(ii, jj, k) + al*(1.-bt)*vp.point(kk, jj, k) 01818 + (1.-al)*bt*vp.point(ii, ll, k) + al*bt*vp.point(kk, ll, k) + 0.5); 01819 } 01820 } 01821 } 01822 } 01823 01824 else { 01825 int ii, jj; 01826 01827 for(int k=0; k<vx.zs; k++) { 01828 pz = k*ps; 01829 for(int j=0; j<yss; j++) { 01830 py = pz + j*xss; 01831 for(int i=0; i<xss; i++) { 01832 ii = (int)(i/zm); 01833 jj = (int)(j/zm); 01834 vx.gp[py+i] = vp.point(ii, jj, k); 01835 } 01836 } 01837 } 01838 } 01839 01840 return vx; 01841 }
MSGraph<R> jbxl::zSobel | ( | MSGraph< T > | vp | ) | [inline] |
template<typename R, typename T> MSGraph<R> zSobel(MSGraph<T> vp)
グラフィックデータの Z方向微分(Sobel)を計算する.
vp | 計算対象となるグラフィックデータ構造体. |
Definition at line 288 of file Gmt.h.
References MSGraph< T >::base, DEBUG_MODE, GetUsableGlobalCounter(), MSGraph< T >::gp, MSGraph< T >::isNull(), JBXL_GRAPH_MEMORY_ERROR, JBXL_GRAPH_NODATA_ERROR, MSGraph< T >::mimicry(), PRINT_MESG, CVCounter::PutFill(), CVCounter::SetMax(), MSGraph< T >::state, CVCounter::StepIt(), MSGraph< T >::xs, MSGraph< T >::ys, MSGraph< T >::zero, and MSGraph< T >::zs.
00289 { 00290 int i, j, k; 00291 int pl, nx, ny, nz; 00292 R da, db, dc, dd, de; 00293 MSGraph<R> xp; 00294 00295 xp.mimicry(vp); 00296 xp.base = xp.zero = 0; 00297 00298 if (xp.isNull()) { 00299 DEBUG_MODE PRINT_MESG("ZSOBEL: No More Memory!!\n"); 00300 xp.state = JBXL_GRAPH_MEMORY_ERROR; 00301 return xp; 00302 } 00303 if (vp.zs<2) { 00304 xp.state = JBXL_GRAPH_NODATA_ERROR; 00305 return xp; // 0 のグラフィックデータを返す 00306 } 00307 00308 // カウンタ 00309 CVCounter* vcounter = NULL; 00310 if (vp.zs>2) vcounter = GetUsableGlobalCounter(); 00311 if (vcounter!=NULL) vcounter->SetMax(vp.zs-1); 00312 00313 pl = vp.xs*vp.ys; 00314 for (k=1; k<vp.zs-1; k++) { 00315 nz = k*pl; 00316 for (j=1; j<vp.ys-1; j++) { 00317 ny = nz + j*vp.xs; 00318 for (i=1; i<vp.xs-1; i++) { 00319 nx = ny +i; 00320 da = vp.gp[nx-1+pl] - vp.gp[nx-1-pl]; 00321 db = vp.gp[nx+1+pl] - vp.gp[nx+1-pl]; 00322 dc = vp.gp[nx +pl] - vp.gp[nx -pl]; 00323 dd = vp.gp[nx-vp.xs+pl] - vp.gp[nx-vp.xs-pl]; 00324 de = vp.gp[nx+vp.xs+pl] - vp.gp[nx+vp.xs-pl]; 00325 //da = vp.point(i-1, j, k+1) - vp.point(i-1, j, k-1); 00326 //db = vp.point(i+1, j, k+1) - vp.point(i+1, j, k-1); 00327 //dc = vp.point(i, j, k+1) - vp.point(i, j, k-1); 00328 //dd = vp.point(i, j-1, k+1) - vp.point(i, j-1, k-1); 00329 //de = vp.point(i, j+1, k+1) - vp.point(i, j+1, k-1); 00330 xp.gp[nx] = (R)((da + db + 2.*dc + dd + de)/12.); 00331 } 00332 } 00333 if (vcounter!=NULL) vcounter->StepIt(); 00334 } 00335 00336 // k==0 and k==vp.zs-1 00337 nz = (vp.zs-1)*pl; 00338 for (j=1; j<vp.ys-1; j++) { 00339 ny = j*vp.xs; 00340 for (i=1; i<vp.xs-1; i++) { 00341 nx = ny + i; 00342 da = vp.gp[nx]; 00343 db = vp.gp[nx+pl]; 00344 dc = vp.gp[nx+1 +pl] + vp.gp[nx-1 +pl]; 00345 dd = vp.gp[nx+vp.xs+pl] + vp.gp[nx-vp.xs+pl]; 00346 //da = vp.point(i, j, 0); 00347 //db = vp.point(i, j, 1); 00348 //dc = vp.point(i+1, j, 1) + vp.point(i-1, j, 1); 00349 //dd = vp.point(i, j+1, 1) + vp.point(i, j-1, 1); 00350 xp.gp[nx] = (R)((2.*db + dc + dd)/6. - da); 00351 } 00352 00353 ny = ny + nz; 00354 for (i=1; i<vp.xs-1; i++) { 00355 nx = ny + i; 00356 da = vp.gp[nx]; 00357 db = vp.gp[nx-pl]; 00358 dc = vp.gp[nx+1 -pl] + vp.gp[nx-1 -pl]; 00359 dd = vp.gp[nx+vp.xs-pl] + vp.gp[nx-vp.xs-pl]; 00360 //da = vp.point(i, j, vp.zs-1); 00361 //db = vp.point(i, j, vp.zs-2); 00362 //dc = vp.point(i+1, j, vp.zs-2) + vp.point(i-1, j, vp.zs-2); 00363 //dd = vp.point(i, j+1, vp.zs-2) + vp.point(i, j-1, vp.zs-2); 00364 xp.gp[nx] = (R)(da - (2.*db + dc + dd)/6.); 00365 } 00366 } 00367 00368 if (vcounter!=NULL) vcounter->PutFill(); 00369 00370 return xp; 00371 }
MSGraph<R> jbxl::zzSobel | ( | MSGraph< T > | vp | ) | [inline] |
template<typename R, typename T> MSGraph<R> zzSobel(MSGraph<T> vp)
グラフィックデータの Z方向の 2階微分(Sobel)を計算する.
vp | 計算対象となるグラフィックデータ構造体. |
Definition at line 570 of file Gmt.h.
References CVCounter::DeleteChildCounter(), MSGraph< T >::free(), GetUsableGlobalCounter(), MSGraph< T >::isNull(), JBXL_GRAPH_NODATA_ERROR, CVCounter::MakeChildCounter(), MSGraph< T >::mimicry(), CVCounter::PutFill(), SetGlobalCounter(), CVCounter::SetMax(), MSGraph< T >::state, and MSGraph< T >::zs.
00571 { 00572 int i, j, k; 00573 R da, db, dc, dd, de; 00574 R df, dg, dh, di, dj, dk, dl, dm; 00575 MSGraph<R> pp, xp; 00576 00577 if (vp.zs<2) { // 0 のグラフィックデータを返す 00578 pp.mimicry(vp); 00579 pp.state = JBXL_GRAPH_NODATA_ERROR; 00580 return pp; 00581 } 00582 00583 // カウンタ 00584 CVCounter* vcounter = NULL; 00585 CVCounter* ccounter = NULL; 00586 if (vp.zs>2) vcounter = GetUsableGlobalCounter(); 00587 if (vcounter!=NULL) { 00588 vcounter->SetMax(200); 00589 ccounter = vcounter->MakeChildCounter(100); 00590 SetGlobalCounter(ccounter); 00591 } 00592 00593 pp = zSobel<R>(vp); 00594 00595 if (vcounter!=NULL) { 00596 vcounter->DeleteChildCounter(); 00597 ccounter = vcounter->MakeChildCounter(100); 00598 SetGlobalCounter(ccounter); 00599 } 00600 00601 if (!pp.isNull()) { 00602 xp = zSobel<R>(pp); 00603 pp.free(); 00604 } 00605 else xp = pp; 00606 00607 if (vcounter!=NULL) { 00608 vcounter->DeleteChildCounter(); 00609 SetGlobalCounter(vcounter); 00610 vcounter->PutFill(); 00611 } 00612 00613 /* if (vp.zs<5) return xp; 00614 for (k=2; k<vp.zs-2; k++) { 00615 for (j=2; j<vp.ys-2; j++) { 00616 for (i=2; i<vp.xs-2; i++) { 00617 da = vp.point(i, j, k+2) - 2*vp.point(i, j, k) + vp.point(i, j, k-2); 00618 db = vp.point(i+1, j, k+2) - 2*vp.point(i+1, j, k) + vp.point(i+1, j, k-2); 00619 dc = vp.point(i-1, j, k+2) - 2*vp.point(i-1, j, k) + vp.point(i-1, j, k-2); 00620 dd = vp.point(i, j+1, k+2) - 2*vp.point(i, j+1, k) + vp.point(i, j+1, k-2); 00621 de = vp.point(i, j-1, k+2) - 2*vp.point(i, j-1, k) + vp.point(i, j-1, k-2); 00622 df = vp.point(i+1, j+1, k+2) - 2*vp.point(i+1, j+1, k) + vp.point(i+1, j+1, k-2); 00623 dg = vp.point(i+1, j-1, k+2) - 2*vp.point(i+1, j-1, k) + vp.point(i+1, j-1, k-2); 00624 dh = vp.point(i-1, j+1, k+2) - 2*vp.point(i-1, j+1, k) + vp.point(i-1, j+1, k-2); 00625 di = vp.point(i-1, j-1, k+2) - 2*vp.point(i-1, j-1, k) + vp.point(i-1, j-1, k-2); 00626 dj = vp.point(i+2, j, k+2) - 2*vp.point(i+2, j, k) + vp.point(i+2, j, k-2); 00627 dk = vp.point(i-2, j, k+2) - 2*vp.point(i-2, j, k) + vp.point(i-2, j, k-2); 00628 dl = vp.point(i, j+2, k+2) - 2*vp.point(i, j+2, k) + vp.point(i, j+2, k-2); 00629 dm = vp.point(i, j-2, k+2) - 2*vp.point(i, j-2, k) + vp.point(i, j-2, k-2); 00630 xp.point(i, j, k) = (R)((8.*da + 4.*(db+dc+dd+de) + 2.*(df+dg+dh+di) +dj+dk+dl+dm)/144.); 00631 } 00632 } 00633 } 00634 */ 00635 return xp; 00636 }
double Abs_Vector_Tolerance = 1.0e-4 |
Definition at line 23 of file Tolerance.cpp.
Referenced by SetAbsVectorTolerance().
double Abs_Vertex_Tolerance = 1.0e-4 |
Definition at line 24 of file Tolerance.cpp.
Referenced by BREP_VERTEX::BREP_VERTEX(), BREP_VERTEX::ComputeTolerance(), and SetAbsVertexTolerance().
class DllExport BREP_CONTOUR |
Definition at line 37 of file Brep.h.
Referenced by CreateContour(), and CreateContourByVertex().
class DllExport BREP_EDGE |
Definition at line 38 of file Brep.h.
Referenced by CreateEdge().
class DllExport BREP_FACET |
Definition at line 36 of file Brep.h.
Referenced by BrepSolidList::addSolid(), AddVector2TriSolid(), CreateTriSolidFromSTL(), CreateTriSolidFromVector(), BrepSolidList::getMerge(), PatchupContour(), and ReverseContours().
class DllExport BREP_SHELL |
Definition at line 35 of file Brep.h.
Referenced by BrepSolidList::addSolid(), CreateTriSolidFromSTL(), CreateTriSolidFromVector(), and BrepSolidList::getMerge().
class DllExport BREP_SOLID |
Definition at line 34 of file Brep.h.
Referenced by BrepSolidList::addSolid(), MeshObjectNode::computeVertexByBREP(), and BrepSolidList::getMerge().
class DllExport BREP_VERTEX |
Definition at line 40 of file Brep.h.
Referenced by CreateContourByVector().
class DllExport BREP_WING |
Definition at line 39 of file Brep.h.
Referenced by BREP_EDGE::BREP_EDGE().
double Collision_Tolerance = 1.0e-2 |
Definition at line 25 of file Tolerance.cpp.
Referenced by CollisionTriContour2D(), CollisionTriContour3D(), IsInTriangle(), and SetCollisionTolerance().
double Edge_Tolerance = 1.0e-12 |
Definition at line 19 of file Tolerance.cpp.
Referenced by BREP_EDGE::BREP_EDGE(), and SetEdgeTolerance().
double Facet_Tolerance = 1.0e-12 |
Definition at line 20 of file Tolerance.cpp.
Referenced by BREP_FACET::BREP_FACET(), BREP_FACET::ComputePlaneEquation(), and SetFacetTolerance().
Definition at line 24 of file ClassBox.cpp.
Referenced by ClearGlobalCounter(), GetUsableGlobalCounter(), and SetGlobalCounter().
Definition at line 18 of file ClassBox.cpp.
Referenced by ClearGlobalDisplay(), and SetGlobalDisplay().
Definition at line 17 of file ClassBox.cpp.
Referenced by ClearGlobalFrame(), and SetGlobalFrame().
CVTextDocument * GLTextDocument = NULL |
Definition at line 19 of file ClassBox.cpp.
Referenced by ClearGlobalTextDocument(), and SetGlobalTextDocument().
class DllExport OctreeNode |
Definition at line 41 of file Brep.h.
Referenced by BREP_SOLID::BREP_SOLID().
class DllExport Quaternion |
Definition at line 24 of file Rotation.h.
double Sin_Tolerance = 1.0e-6 |
Definition at line 26 of file Tolerance.cpp.
Referenced by SetSINTolerance(), SlerpQuaternion(), and ToPola().
int TempBase = 0 |
Definition at line 15 of file Gdata.cpp.
Referenced by writeCmnHeadData(), and writeGraphicFile().
double Vector_Tolerance = 1.0e-6 |
Definition at line 17 of file Tolerance.cpp.
Referenced by same_vector(), and SetVectorTolerance().
double Vertex_Tolerance = 1.0e-6 |
Definition at line 18 of file Tolerance.cpp.
Referenced by BREP_VERTEX::ComputeTolerance(), and SetVertexTolerance().
double Zero_Eps = 1.0e-6 |
Definition at line 29 of file Tolerance.cpp.
Referenced by CollisionTriContour2D(), CollisionTriContour3D(), IsAtLine(), Vector< T >::normalize(), Quaternion< T >::normalize(), ProportionVector(), RotMatrixElements2ExtEulerXYZ(), RotMatrixElements2ExtEulerXZY(), RotMatrixElements2ExtEulerYXZ(), RotMatrixElements2ExtEulerYZX(), RotMatrixElements2ExtEulerZXY(), RotMatrixElements2ExtEulerZYX(), SamePlaneContour(), SetZeroEPS(), V2VQuaternion(), and VectorAngle().
Definition at line 30 of file Tolerance.cpp.
int ZeroBase = 0 |
Definition at line 14 of file Gdata.cpp.
Referenced by readGraphicFile(), and readGraphicSlices().