26 throw std::runtime_error(
"buildCylinderOcc: radius must be positive.");
28 throw std::runtime_error(
"buildCylinderOcc: length must be positive.");
35 gmsh::model::occ::synchronize();
40 if (e.
d_a <= 0. || e.
d_b <= 0.)
41 throw std::runtime_error(
"buildEllipseOcc: semi-axes must be positive.");
43 const double rx = std::max(e.
d_a, e.
d_b);
44 const double ry = std::min(e.
d_a, e.
d_b);
50 gmsh::model::occ::synchronize();
52 gmsh::model::occ::synchronize();
53 gmsh::model::mesh::embed(0, {p}, 2, s);
58 if (e.
d_a <= 0. || e.
d_b <= 0. || e.
d_c <= 0.)
59 throw std::runtime_error(
"buildEllipsoidOcc: semi-axes must be positive.");
65 std::vector<double> mat(16);
66 for (
int i = 0; i < 3; ++i) {
67 mat[
static_cast<size_t>(i * 4 + 0)] = R[i * 3 + 0] * e.
d_a;
68 mat[
static_cast<size_t>(i * 4 + 1)] = R[i * 3 + 1] * e.
d_b;
69 mat[
static_cast<size_t>(i * 4 + 2)] = R[i * 3 + 2] * e.
d_c;
70 mat[
static_cast<size_t>(i * 4 + 3)] = (i == 0) ? e.
d_x.
d_x : (i == 1) ? e.
d_x.
d_y : e.
d_x.
d_z;
72 mat[12] = mat[13] = mat[14] = 0.;
75 const int v = gmsh::model::occ::addSphere(0., 0., 0., 1.);
76 gmsh::model::occ::synchronize();
77 gmsh::model::occ::affineTransform({{3, v}}, mat);
78 gmsh::model::occ::synchronize();
79 gmsh::model::occ::removeAllDuplicates();
80 gmsh::model::occ::synchronize();
util::Point d_xBegin
Center point of cross-section at the beginning.
util::Point d_xa
Axis of cylinder (unit vector)
Filled ellipse in the plane z = center.d_z, semi-axes in the xy plane.
double d_a
Semi-axis along local x before rotation (in-plane)
double d_b
Semi-axis along local y before rotation (in-plane)
double d_theta
Counter-clockwise rotation about +z through the center (radians)
Ellipsoid: center , semi-axes in a body frame rotated from world by axis–angle (Rodrigues)....
void ellipsoidRotationMatrix(const Ellipsoid &e, double R[9])
Row-major 3×3 rotation from ellipsoid axis–angle (identity if ).
void buildEllipsoidOcc(const geom::Ellipsoid &e)
int addDiskOcc(double xc, double yc, double zc, double rx, double ry, double theta=0.)
OCC disk compatible with older Gmsh (no zAxis/xAxis) and newer APIs.
void buildEllipseOcc(const geom::Ellipse &e, double h)
void buildCylinderOcc(const geom::Cylinder &c)
double d_y
the y coordinate
double d_z
the z coordinate
double d_x
the x coordinate