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 "memvirtu.h"
00043 #include "lowparam.h"
00044 #include "lowsolid.h"
00045 #include "eulerops.h"
00046 #include "vectorop.h"
00047 #include "mancommd.h"
00048 #include "shpshape.h"
00049
00050 SPTYPE MSD_lowMakePyramid(Id sn, XY *listvtx, real h, int n)
00051 {
00052 SPTYPE s;
00053 Id face;
00054 int flag = 1, GOld;
00055 static vector vec = { 0.0, 0.0, 1.0, 0.0 };
00056
00057 GOld = Gdoinversion;
00058 Gdoinversion = FALSE;
00059 CommandCount++;
00060 if ((s = MSD_lowMakePolygon(sn, listvtx, n, 1)) == SNIL)
00061 {
00062 flag = 0;
00063 }
00064 face = dot(FacFeq(MSD_getFace(s, maxf - 2)), vec) > 0.0 ? maxf - 2 : maxf - 1;
00065 if (MSD_lowMakeSweep(MSD_getFace(s, face), 0.0, 0.0, h) == ERROR)
00066 {
00067 flag = 0;
00068 }
00069 if (flag == 1)
00070 {
00071 MSD_lowSetFaceToPoint(MSD_getFace(s, face), 0.0, 0.0, h);
00072 MSD_lowMakeFaceToPoint(MSD_getFace(s, face));
00073 MSD_lowSetNormal(s, TRUE);
00074 MSD_lowSetEdgeAngle(s);
00075 MSD_lowSetInfo(s);
00076 }
00077 if (flag == 0)
00078 {
00079 MSD_lowHardRemove(s);
00080 }
00081 if (flag == 1)
00082 {
00083 MSD_lowAddEulerOp(s, HARDREM, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00084 }
00085 Gdoinversion = GOld;
00086 return(flag == 0 ? SNIL : s);
00087 }
00088
00089
00090
00091
00092 void MSD_lowSetFaceToPoint(FPTYPE fptr, real x, real y, real z)
00093 {
00094 HPTYPE he;
00095
00096 he = LooLEdg(FacFLoops(fptr));
00097 do
00098 {
00099 VerVCoord(HalVtx(he))[0] = x;
00100 VerVCoord(HalVtx(he))[1] = y;
00101 VerVCoord(HalVtx(he))[2] = z;
00102 } while (LooLEdg(FacFLoops(fptr)) != (he = HalNxt(he)));
00103 }