TopoDS_Shape CreateEllipsoid::executeCreation() const { try { gp_Pnt pnt(axis.Location()); gp_Dir dir(axis.Direction()); gp_Ax2 ax2(pnt, dir); BRepPrimAPI_MakeSphere makeSphere(ax2, radius2, angle/180.0f*Standard_PI); float scale = radius1 / radius2; gp_Dir xDir = ax2.XDirection(); gp_Dir yDir = ax2.YDirection(); gp_GTrsf mat; mat.SetValue(1, 1, xDir.X()); mat.SetValue(2, 1, xDir.Y()); mat.SetValue(3, 1, xDir.Z()); mat.SetValue(1, 2, yDir.X()); mat.SetValue(2, 2, yDir.Y()); mat.SetValue(3, 2, yDir.Z()); mat.SetValue(1, 3, dir.X()*scale); mat.SetValue(2, 3, dir.Y()*scale); mat.SetValue(3, 3, dir.Z()*scale); BRepBuilderAPI_GTransform trs(makeSphere.Shape(), mat); return trs.Shape(); } catch(const StdFail_NotDone& ex) { throw Common::Exception(QObject::tr("Create ellipsoid error")); } }
std::shared_ptr<odb::database> PostgreSQLDatabase::create( const std::string& username, const std::string& password, const std::string& dbname, const std::string& host, const unsigned int& port) { try { std::shared_ptr<odb::database> db( new odb::pgsql::database(username, password, dbname, host, port)); odb::core::transaction trs(db->begin()); odb::core::schema_catalog::create_schema(*db); trs.commit(); return db; } catch (const odb::exception& exception) { Exception::Domain::CreateDatabaseException(exception); } return nullptr; }
/// Get Absolute Motor Relative to Origin Mot Frame::mot() const { Mot m(trs() * rot()); VT n = m.rnorm(); return (n !=0 ) ? m / n : m ; }