Newer
Older
#include "CutSphere.h"
double opt_cut_sphere_Xc(OPT_ARGS_NUM)
{
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
}
StringXNumber CutSphereOptions_Number[] = {
{ GMSH_FULLRC, "Xc" , opt_cut_sphere_Xc , 1. },
{ GMSH_FULLRC, "Yc" , opt_cut_sphere_Xc , 1. },
{ GMSH_FULLRC, "Zc" , opt_cut_sphere_Xc , 1. },
{ GMSH_FULLRC, "R" , opt_cut_sphere_Xc , 1. }
};
extern "C"
{
GMSH_Plugin *GMSH_RegisterCutSpherePlugin ()
{
return new GMSH_CutSpherePlugin (0.0,0.0,0.0,.25);
}
}
GMSH_CutSpherePlugin::GMSH_CutSpherePlugin(double A, double B, double C, double D)
:a(A),b(B),c(C),r(D)
{
}
void GMSH_CutSpherePlugin::getName(char *name) const
{
strcpy(name,"Cut Sphere");
}
void GMSH_CutSpherePlugin::getInfos(char *author, char *copyright, char *help_text) const
{
strcpy(author,"J.-F. Remacle (remacle@scorec.rpi.edu)");
strcpy(copyright,"DGR (www.multiphysics.com)");
strcpy(help_text,"This Plugins cuts a view \n with a plane (x-xc)^2 + (y-yc)^2 + (z-zc)^2 = r^20\n");
}
int GMSH_CutSpherePlugin::getNbOptions() const
{
return 4;
}
void GMSH_CutSpherePlugin:: GetOption (int iopt, StringXNumber *option) const
{
*option = CutSphereOptions_Number[iopt];
}
void GMSH_CutSpherePlugin::CatchErrorMessage (char *errorMessage) const
{
strcpy(errorMessage,"CutSphere Failed...");
}
double GMSH_CutSpherePlugin :: levelset (double x, double y, double z) const
{
return (x-a)*(x-a) + (y-b)*(y-b) + (z-c)*(z-c) - r*r;
}