00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #include <stdio.h>
00042 #include <math.h>
00043 #include "memvirtu.h"
00044 #include "lowparam.h"
00045 #include "lowmacro.h"
00046 #include "lowsolid.h"
00047 #include "vectorop.h"
00048 #include "shpshape.h"
00049
00050 void MSD_lowSetNormal(SPTYPE optr, int op)
00051 {
00052 DPTYPE dptr;
00053 FPTYPE fptr;
00054
00055 if ((op == TRUE) || ((op == FALSE) && SolidBoxNOK(optr)))
00056 {
00057 MSD_lowSolidBox(optr, &(SolBox(optr)));
00058 }
00059 for (AllShellsSolid(optr, dptr))
00060 {
00061 if ((op == TRUE) || ((op == FALSE) && ShellBoxNOK(dptr)))
00062 {
00063 MSD_lowShellBox(dptr);
00064 }
00065 for (AllFacesShell(dptr, fptr))
00066 {
00067 if (op == TRUE)
00068 {
00069 MSD_lowFaceEq(FacFLOut(fptr), FacFeq(fptr));
00070 MSD_lowFaceBox(fptr);
00071 }
00072 else
00073 {
00074 if (FaceEqNOK(fptr))
00075 {
00076 MSD_lowFaceEq(FacFLOut(fptr), FacFeq(fptr));
00077 }
00078 if (FaceBoxNOK(fptr))
00079 {
00080 MSD_lowFaceBox(fptr);
00081 }
00082 }
00083 }
00084 }
00085 }
00086
00087 void MSD_lowSetEdgeAngle(SPTYPE optr)
00088 {
00089 DPTYPE dptr;
00090 EPTYPE eptr;
00091 vector edir1, edir2;
00092 vector spnt, epnt, lfac, rfac;
00093 double th, costh;
00094
00095 for (AllShellsSolid(optr, dptr))
00096 {
00097 for (AllEdgesShell(dptr, eptr))
00098 {
00099 EdgAngle(eptr) = 0.0;
00100 veccopy(spnt, VerVCoord(HalVtx(EdgHe1(eptr))));
00101 veccopy(epnt, VerVCoord(HalVtx(EdgHe2(eptr))));
00102 vecminus(edir1, epnt, spnt);
00103 if (normalize(edir1))
00104 {
00105 veccopy(lfac, FacFeq(LooLFace(HalWLoop(EdgHe1(eptr)))));
00106 veccopy(rfac, FacFeq(LooLFace(HalWLoop(EdgHe2(eptr)))));
00107 costh = dot(lfac, rfac);
00108 if ((costh >= -1.0) && (costh <= 1.0))
00109 {
00110 th = acos(costh);
00111 if (dot(cross(edir2, lfac, rfac), edir1) < 0.0)
00112 {
00113 th = -th;
00114 }
00115 EdgAngle(eptr) = th;
00116 }
00117 }
00118 }
00119 }
00120 }