void BevelFrame::draw(Canvas* c, const Allocation& a) const { Coord t = thickness(c); draw_frame(c, a, t); Glyph* g = body(); if (g != nil) { if (hmargin_ || vmargin_) { Allocation interior(a); allocate_body(g, t, interior); g->draw(c, interior); } else { g->draw(c, a); } } }
void BevelFrame::print(Printer* p, const Allocation& a) const { Coord t = thickness(p); draw_frame(p, a, t); Glyph* g = body(); if (g != nil) { if (hmargin_ || vmargin_) { Allocation interior(a); allocate_body(g, t, interior); g->print(p, interior); } else { g->print(p, a); } } }
QRect QSlider::sliderRect() const { QRect r; switch ( (GUIStyle)style() ) { case WindowsStyle: if (orient == Horizontal ) r.setRect( sliderPos, tickOffset, style().sliderLength(), thickness() ); else r.setRect ( tickOffset, sliderPos, thickness(), style().sliderLength() ); break; default: case MotifStyle: if (orient == Horizontal ) r.setRect ( sliderPos + motifBorder, tickOffset + motifBorder, style().sliderLength(), thickness() - 2 * motifBorder ); else r.setRect ( tickOffset + motifBorder, sliderPos + motifBorder, thickness() - 2 * motifBorder, style().sliderLength() ); break; } return r; }
//===== Run Six Series Code =====// void Af::load_6_series_curves() { int i; //==== Run Six Series Fortran Generation Code ====// float cli = (float)ideal_cl(); float ta = (float)a(); float toc = (float)thickness(); sixseries_( &sixser, &toc, &cli, &ta ); int num_pnts_upper = sixpnts_.nmu; int num_pnts_lower = sixpnts_.nml; upper_curve.init(num_pnts_upper); for (i = 0 ; i < num_pnts_upper ; i++) { float x = sixpnts_.xxu[i]; float z = sixpnts_.yyu[i]; upper_curve.load_pnt( i, vec3d(x, 0.0, z)); } lower_curve.init(num_pnts_lower); for (i = 0 ; i < num_pnts_lower ; i++) { float x = sixpnts_.xxl[i]; float z = sixpnts_.yyl[i]; lower_curve.load_pnt( i, vec3d(x, 0.0, z)); } //==== Close Trailing Edge - Set Last Points ====// vec3d last_pnt = upper_curve.get_pnt(num_pnts_upper-1) + lower_curve.get_pnt(num_pnts_lower-1); upper_curve.load_pnt(num_pnts_upper-1, last_pnt*0.5); lower_curve.load_pnt(num_pnts_lower-1, last_pnt*0.5); upper_curve.comp_tans(); lower_curve.comp_tans(); vec3d leading_edge_tan = vec3d(0.0, 0.0, 1.0); float tan_mag = (float)upper_curve.get_tan(0).mag(); upper_curve.load_tan( 0, leading_edge_tan*tan_mag); tan_mag = -(float)(lower_curve.get_tan(0).mag()); lower_curve.load_tan( 0, leading_edge_tan*tan_mag); }
// Construct corner-point grid from EclipseGrid. void GridManager::initFromEclipseGrid(const Opm::EclipseGrid& inputGrid, const std::vector<double>& poreVolumes) { struct grdecl g; std::vector<int> actnum; std::vector<double> coord; std::vector<double> zcorn; std::vector<double> mapaxes; g.dims[0] = inputGrid.getNX(); g.dims[1] = inputGrid.getNY(); g.dims[2] = inputGrid.getNZ(); inputGrid.exportMAPAXES( mapaxes ); inputGrid.exportCOORD( coord ); inputGrid.exportZCORN( zcorn ); inputGrid.exportACTNUM( actnum ); g.coord = coord.data(); g.zcorn = zcorn.data(); g.actnum = actnum.data(); g.mapaxes = mapaxes.data(); if (!poreVolumes.empty() && (inputGrid.getMinpvMode() != MinpvMode::ModeEnum::Inactive)) { MinpvProcessor mp(g.dims[0], g.dims[1], g.dims[2]); const std::vector<double>& minpvv = inputGrid.getMinpvVector(); const size_t cartGridSize = g.dims[0] * g.dims[1] * g.dims[2]; std::vector<double> thickness(cartGridSize); for (size_t i = 0; i < cartGridSize; ++i) { thickness[i] = inputGrid.getCellThicknes(i); } // The legacy code only supports the opmfil option bool opmfil = true; //inputGrid.getMinpvMode() == MinpvMode::OpmFIL; const double z_tolerance = inputGrid.isPinchActive() ? inputGrid.getPinchThresholdThickness() : 0.0; mp.process(thickness, z_tolerance, poreVolumes, minpvv, actnum, opmfil, zcorn.data()); } const double z_tolerance = inputGrid.isPinchActive() ? inputGrid.getPinchThresholdThickness() : 0.0; ug_ = create_grid_cornerpoint(&g, z_tolerance); if (!ug_) { OPM_THROW(std::runtime_error, "Failed to construct grid."); } attach_zcorn_copy( ug_ , zcorn.data() ); }
void CSideBar::OnMouseMove(UINT nFlags, CPoint point) { if (m_resizing) { CWindowDC dc(m_pDockSite); CRect nextrect = m_dragrect; nextrect.left = point.x; if (nextrect.left < 32) { nextrect.left = 32; } nextrect.right = nextrect.left + 4; CSize thickness(2,2); dc.DrawDragRect(nextrect, thickness, m_dragrect, thickness); m_dragrect = nextrect; } CDialogBar::OnMouseMove(nFlags, point); }
//===== Load Name And Number of 4 Series =====// void Af::load_name_4_series() { int icam = int(camber()*100.0f + 0.5f); int icam_loc = int(camber_loc()*10.0f + 0.5f); int ithick = int(thickness()*100.0f + 0.5f); if (icam == 0) icam_loc = 0; char str[255]; if (ithick < 10) sprintf(str, "NACA %d%d0%d", icam, icam_loc, ithick); else sprintf(str, "NACA %d%d%d", icam, icam_loc, ithick); name = str; }
void ClipGrabber::wheelEvent(QWheelEvent* const event, Camera* const camera) { int mag = event->delta()/8.0f/15.0f; if (event->modifiers() & Qt::ShiftModifier) { int tk = thickness(); tk = qBound(0, tk+mag, 100); setThickness(tk); } else { Vec tang = m_tang; translate(mag*tang); } }
void CSideBar::OnLButtonUp(UINT nFlags, CPoint point) { if (m_resizing) { m_resizing = false; CWindowDC dc(m_pDockSite); CSize thickness(2,2); dc.DrawDragRect(m_dragrect, thickness, NULL, thickness); ReleaseCapture(); m_sizeDefault.cx = point.x; if (m_sizeDefault.cx < 32) { m_sizeDefault.cx = 32; } m_pDockSite->RepositionBars(0,0xFFFF,AFX_IDW_PANE_FIRST); } CDialogBar::OnLButtonUp(nFlags, point); }
void CSideBar::OnNcLButtonDown(UINT nHitTest, CPoint point) { if (nHitTest == HTRIGHT) { m_resizing = true; CRect rect; // complicated: client rect of m_pDockSite is misleading: GetWindowRect(m_dragrect); m_pDockSite->GetWindowRect(rect); m_dragrect.OffsetRect(-rect.left,-rect.top); m_dragrect.left = m_dragrect.right - 4; CWindowDC dc(m_pDockSite); CSize thickness(2,2); dc.DrawDragRect(m_dragrect, thickness, NULL, thickness); SetCapture(); } else { CDialogBar::OnNcLButtonDown(nHitTest, point); } }
//===== Generate From File Curve =====// void Af::generate_from_file_curve() { int i; float u; //==== Initialize Array For Points ====// int npnts = num_pnts; pnts.init(npnts); //==== Generate Airfoil ====// int half_pnts = npnts/2; for ( i = 0 ; i < half_pnts+1 ; i++) { //==== X*X Distribution of Points ====// u = (float)i / (float)half_pnts; u = u*sqrt(u); // u = u*u; //==== More Evenly Spaced Distribution of Points -DJK ====// u = (float)i / (float)half_pnts; u = u*sqrt(u); //==== Compute Upper Surface Points ====// pnts[half_pnts-i] = upper_curve.comp_pnt_per_length(u); //==== Compute Lower Surface Points ====// pnts[half_pnts+i] = lower_curve.comp_pnt_per_length(u); } //==== Scale Airfoil Thickness ====// double z_avg; double thick_scale = thickness()/orig_af_thickness; for ( i = 0 ; i < half_pnts+1 ; i++) { z_avg = 0.5*(pnts[half_pnts-i].z() + pnts[half_pnts+i].z()); pnts[half_pnts-i].set_z( (pnts[half_pnts-i].z() - z_avg)*thick_scale + z_avg ); pnts[half_pnts+i].set_z( (pnts[half_pnts+i].z() - z_avg)*thick_scale + z_avg ); } }
QRect QvisOpacitySlider::sliderRect() const { return QRect(sliderPos, tickOffset, sliderLength(), thickness()); }
void MSVSeparator::computeSize(void) { width((marginWidth()+shadowThickness()+highlightThickness()+thickness())*2); }
// get unscaled volume for use only in contact and imperfect interface calculations // For axisymmetric, really needs area of the initial particle domain in mm^3 // Calculations will need to multiply by radial position to get local volume // Here thickness is the original radial position of the particle double MatPointAS::GetUnscaledVolume(void) { double rho=theMaterials[MatID()]->rho; // in g/mm^3 return mp/(rho*thickness()); // in mm^3 per unit radial position }
void QvisOpacitySlider::initTicks() { tickOffset = height() - thickness(); }
double RefractionExtinctionGlazing_Impl::thermalConductance() const { return thermalConductivity()/thickness(); }
Quantity RefractionExtinctionGlazing_Impl::getThickness(bool returnIP) const { OptionalDouble value = thickness(); OSOptionalQuantity result = getQuantityFromDouble(OS_WindowMaterial_Glazing_RefractionExtinctionMethodFields::Thickness, value, returnIP); OS_ASSERT(result.isSet()); return result.get(); }
int main(int argc, char** argv) { sf::RenderWindow* RenderWin = new sf::RenderWindow(sf::VideoMode(WIDTH, HEIGHT, 32), "lol test"); RenderWin->UseVerticalSync(true); // Collision configuration contains default setup for memory, collision setup. Advanced users can create their own configuration. boost::shared_ptr<btDefaultCollisionConfiguration> collisionConfiguration(new btDefaultCollisionConfiguration()); // Use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded). boost::shared_ptr<btCollisionDispatcher> dispatcher(new btCollisionDispatcher(collisionConfiguration.get())); // btDbvtBroadphase is a good general purpose broadphase. You can also try out btAxis3Sweep. boost::shared_ptr<btBroadphaseInterface> broadphase(new btDbvtBroadphase()); // The default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded). boost::shared_ptr<btVoronoiSimplexSolver> simplex(new btVoronoiSimplexSolver()); boost::shared_ptr<btMinkowskiPenetrationDepthSolver> pd_solver(new btMinkowskiPenetrationDepthSolver()); boost::shared_ptr<btSequentialImpulseConstraintSolver> solver(new btSequentialImpulseConstraintSolver()); boost::shared_ptr<btDiscreteDynamicsWorld> dynamicsWorld(new btDiscreteDynamicsWorld(dispatcher.get(), broadphase.get(), solver.get(), collisionConfiguration.get())); boost::shared_ptr<btConvex2dConvex2dAlgorithm::CreateFunc> convex_algo_2d(new btConvex2dConvex2dAlgorithm::CreateFunc(simplex.get(),pd_solver.get())); dispatcher->registerCollisionCreateFunc(CONVEX_2D_SHAPE_PROXYTYPE,CONVEX_2D_SHAPE_PROXYTYPE, convex_algo_2d.get()); dispatcher->registerCollisionCreateFunc(BOX_2D_SHAPE_PROXYTYPE,CONVEX_2D_SHAPE_PROXYTYPE, convex_algo_2d.get()); dispatcher->registerCollisionCreateFunc(CONVEX_2D_SHAPE_PROXYTYPE,BOX_2D_SHAPE_PROXYTYPE, convex_algo_2d.get()); dispatcher->registerCollisionCreateFunc(BOX_2D_SHAPE_PROXYTYPE,BOX_2D_SHAPE_PROXYTYPE, new btBox2dBox2dCollisionAlgorithm::CreateFunc()); // Set gravity to 9.8m/s² along y-axis. dynamicsWorld->setGravity(btVector3(0, 1, 0)); // Get us some debug output. Without this, we'd see nothing at all. boost::shared_ptr<DebugDraw> debugDraw(new DebugDraw(RenderWin)); debugDraw->setDebugMode(btIDebugDraw::DBG_DrawWireframe); dynamicsWorld->setDebugDrawer(debugDraw.get()); // Keep track of the shapes, we release memory at exit. // Make sure to re-use collision shapes among rigid bodies whenever possible! btAlignedObjectArray<btCollisionShape*> collisionShapes; // Create a ground body. btScalar thickness(0.2); boost::shared_ptr<btCollisionShape> groundShape(new btBoxShape(btVector3(btScalar(WIDTH / 2 * METERS_PER_PIXEL), thickness, btScalar(10)))); collisionShapes.push_back(groundShape.get()); btTransform groundTransform(btQuaternion(0, 0, 0, 1), btVector3(WIDTH / 2 * METERS_PER_PIXEL, HEIGHT * METERS_PER_PIXEL, 0)); // Using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects. boost::shared_ptr<btDefaultMotionState> groundMotionState(new btDefaultMotionState(groundTransform)); btRigidBody::btRigidBodyConstructionInfo ground_rbInfo(0, groundMotionState.get(), groundShape.get(), btVector3(0, 0, 0)); boost::shared_ptr<btRigidBody> ground_body(new btRigidBody(ground_rbInfo)); ground_body->setLinearFactor(btVector3(1,1,0)); ground_body->setAngularFactor(btVector3(0,0,1)); // Add the body to the dynamics world. dynamicsWorld->addRigidBody(ground_body.get()); // Create left wall. btTransform leftWallTransform(btQuaternion(0, 0, 1, 1), btVector3(0, HEIGHT / 2 * METERS_PER_PIXEL, 0)); boost::shared_ptr<btDefaultMotionState> leftWallMotionState(new btDefaultMotionState(leftWallTransform)); btRigidBody::btRigidBodyConstructionInfo leftWall_rbInfo(0, leftWallMotionState.get(), groundShape.get(), btVector3(0, 0, 0)); boost::shared_ptr<btRigidBody> leftwall_body(new btRigidBody(leftWall_rbInfo)); leftwall_body->setLinearFactor(btVector3(1,1,0)); leftwall_body->setAngularFactor(btVector3(0,0,1)); // Add the body to the dynamics world. dynamicsWorld->addRigidBody(leftwall_body.get()); // Create right wall. btTransform rightWallTransform(btQuaternion(0, 0, 1, 1), btVector3(WIDTH * METERS_PER_PIXEL, HEIGHT / 2 * METERS_PER_PIXEL, 0)); boost::shared_ptr<btDefaultMotionState> rightWallMotionState(new btDefaultMotionState(rightWallTransform)); btRigidBody::btRigidBodyConstructionInfo rightWall_rbInfo(0, rightWallMotionState.get(), groundShape.get(), btVector3(0, 0, 0)); boost::shared_ptr<btRigidBody> rightwall_body(new btRigidBody(rightWall_rbInfo)); rightwall_body->setLinearFactor(btVector3(1,1,0)); rightwall_body->setAngularFactor(btVector3(0,0,1)); // Add the body to the dynamics world. dynamicsWorld->addRigidBody(rightwall_body.get()); // Create ceiling btTransform topWallTransform(btQuaternion(0, 0, 0, 1), btVector3(WIDTH / 2 * METERS_PER_PIXEL, 0, 0)); boost::shared_ptr<btDefaultMotionState> topWallMotionState(new btDefaultMotionState(topWallTransform)); btRigidBody::btRigidBodyConstructionInfo topWall_rbInfo(0, topWallMotionState.get(), groundShape.get(), btVector3(0, 0, 0)); boost::shared_ptr<btRigidBody> topwall_body(new btRigidBody(topWall_rbInfo)); topwall_body->setLinearFactor(btVector3(1,1,0)); topwall_body->setAngularFactor(btVector3(0,0,1)); // Add the body to the dynamics world. dynamicsWorld->addRigidBody(topwall_body.get()); // Create dynamic rigid body. //btCollisionShape* colShape = new btBoxShape(btVector3(1,1,1)); boost::shared_ptr<btCollisionShape> colShape(new btSphereShape(btScalar(0.6))); collisionShapes.push_back(colShape.get()); /// Create Dynamic Objects btTransform startTransform; startTransform.setIdentity(); btScalar mass(1.f); //rigidbody is dynamic if and only if mass is non zero, otherwise static bool isDynamic = (mass != 0.f); btVector3 localInertia(0, 0, 0); if (isDynamic) colShape->calculateLocalInertia(mass,localInertia); startTransform.setOrigin(btVector3(2, 5, 0)); //using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects boost::shared_ptr<btDefaultMotionState> myMotionState(new btDefaultMotionState(startTransform)); btRigidBody::btRigidBodyConstructionInfo rbInfo(mass,myMotionState.get(),colShape.get(),localInertia); boost::shared_ptr<btRigidBody> body(new btRigidBody(rbInfo)); body->setLinearFactor(btVector3(1,1,0)); body->setAngularFactor(btVector3(0,0,1)); dynamicsWorld->addRigidBody(body.get()); // Create lulz boost::ptr_list<btRigidBody> body_list; boost::ptr_list<btDefaultMotionState> motionstate_list; boost::ptr_list<btCollisionShape> colshape_list; for (int i=0;i <= 10; ++i) { if (i < 5) colshape_list.push_back(new btSphereShape(btScalar(sf::Randomizer::Random(0.1f, 0.8f)))); else colshape_list.push_back(new btBoxShape(btVector3(sf::Randomizer::Random(0.1f,0.8f), sf::Randomizer::Random(0.1f,0.8f), 10))); if (isDynamic) colshape_list.back().calculateLocalInertia(mass,localInertia); collisionShapes.push_back(&(colshape_list.back())); startTransform.setIdentity(); startTransform.setOrigin(btVector3(i,i,0)); motionstate_list.push_back(new btDefaultMotionState(startTransform)); btRigidBody* lol = new btRigidBody(btRigidBody::btRigidBodyConstructionInfo(mass,&(motionstate_list.back()),&(colshape_list.back()),localInertia)); lol->setLinearFactor(btVector3(1,1,0)); lol->setAngularFactor(btVector3(0,0,1)); body_list.push_back(lol); } BOOST_FOREACH (btRigidBody& body, body_list) { dynamicsWorld->addRigidBody(&body); }
double Screen_Impl::thermalConductance() const { return thermalConductivity()/thickness(); }
void Af::write(xmlNodePtr node) { int i; xmlAddIntNode( node, "Type", type); xmlAddIntNode( node, "Inverted_Flag", inverted_flag); xmlAddDoubleNode( node, "Camber", camber() ); xmlAddDoubleNode( node, "Camber_Loc", camber_loc() ); xmlAddDoubleNode( node, "Thickness", thickness() ); xmlAddDoubleNode( node, "Thickness_Loc", thickness_loc() ); xmlAddDoubleNode( node, "Radius_Le", radius_le() ); xmlAddDoubleNode( node, "Radius_Te", radius_te() ); xmlAddIntNode( node, "Six_Series", sixser ); xmlAddDoubleNode( node, "Ideal_Cl", ideal_cl() ); xmlAddDoubleNode( node, "A", a() ); if ( type == AIRFOIL_FILE ) { xmlAddStringNode( node, "Name", name() ); xmlAddDoubleNode( node, "Original_AF_Thickness", orig_af_thickness ); xmlAddDoubleNode( node, "Radius_LE_Correction_Factor", radius_le_correction_factor ); xmlAddDoubleNode( node, "Radius_TE_Correction_Factor", radius_te_correction_factor ); vec3d pnt; Stringc upstr; char numstr[255]; for ( i = 0 ; i < upper_curve.get_num_pnts() ; i++) { pnt = upper_curve.get_pnt(i); sprintf( numstr, "%lf, %lf,", pnt.x(), pnt.z() ); upstr.concatenate(numstr); } upstr.concatenate("\0"); xmlAddStringNode( node, "Upper_Pnts", upstr ); Stringc lowstr; for ( i = 0 ; i < lower_curve.get_num_pnts() ; i++) { pnt = lower_curve.get_pnt(i); sprintf( numstr, "%lf, %lf,", pnt.x(), pnt.z() ); lowstr.concatenate(numstr); } lowstr.concatenate("\0"); xmlAddStringNode( node, "Lower_Pnts", lowstr ); } xmlAddIntNode( node, "Slat_Flag", slat_flag ); xmlAddIntNode( node, "Slat_Shear_Flag", slat_shear_flag ); xmlAddDoubleNode( node, "Slat_Chord", slat_chord() ); xmlAddDoubleNode( node, "Slat_Angle", slat_angle() ); xmlAddIntNode( node, "Flap_Flag", flap_flag ); xmlAddIntNode( node, "Flap_Shear_Flag", flap_shear_flag ); xmlAddDoubleNode( node, "Flap_Chord", flap_chord() ); xmlAddDoubleNode( node, "Flap_Angle", flap_angle() ); }
void Af::read(xmlNodePtr node) { int i; int temp_type = xmlFindInt( node, "Type", 0 ); inverted_flag = xmlFindInt( node, "Inverted_Flag", inverted_flag ); camber = xmlFindDouble( node, "Camber", camber() ); camber_loc = xmlFindDouble( node, "Camber_Loc", camber_loc() ); thickness = xmlFindDouble( node, "Thickness", thickness() ); thickness_loc = xmlFindDouble( node, "Thickness_Loc", thickness_loc() ); radius_le = xmlFindDouble( node, "Radius_Le", radius_le() ); radius_te = xmlFindDouble( node, "Radius_Te", radius_te() ); sixser = xmlFindInt( node, "Six_Series", sixser ); ideal_cl = xmlFindDouble( node, "Ideal_Cl", ideal_cl() ); a = xmlFindDouble( node, "A", a() ); slat_flag = xmlFindInt( node, "Slat_Flag", slat_flag ); slat_shear_flag = xmlFindInt( node, "Slat_Shear_Flag", slat_shear_flag ); slat_chord = xmlFindDouble( node, "Slat_Chord", slat_chord() ); slat_angle = xmlFindDouble( node, "Slat_Angle", slat_angle() ); flap_flag = xmlFindInt( node, "Flap_Flag", flap_flag ); flap_shear_flag = xmlFindInt( node, "Flap_Shear_Flag", flap_shear_flag ); flap_chord = xmlFindDouble( node, "Flap_Chord", flap_chord() ); flap_angle = xmlFindDouble( node, "Flap_Angle", flap_angle() ); if ( temp_type == AIRFOIL_FILE ) { vec3d pnt; name = xmlFindString( node, "Name", name ); orig_af_thickness = (float)xmlFindDouble( node, "Original_AF_Thickness", orig_af_thickness ); radius_le_correction_factor = (float)xmlFindDouble( node, "Radius_LE_Correction_Factor", radius_le_correction_factor ); radius_te_correction_factor = (float)xmlFindDouble( node, "Radius_TE_Correction_Factor", radius_te_correction_factor ); xmlNodePtr upp_node = xmlGetNode( node, "Upper_Pnts", 0 ); if ( upp_node ) { int num_arr = xmlGetNumArray( upp_node, ',' ); double* arr = (double*)malloc( num_arr*sizeof(double) ); xmlExtractDoubleArray( upp_node, ',', arr, num_arr ); int num_upper = num_arr/2; upper_curve.init(num_upper); for ( i = 0 ; i < num_arr ; i+=2) { pnt = vec3d(arr[i], 0.0, arr[i+1]); upper_curve.load_pnt( i/2, pnt ); } free(arr); } xmlNodePtr low_node = xmlGetNode( node, "Lower_Pnts", 0 ); if ( low_node ) { int num_arr = xmlGetNumArray( low_node, ',' ); double* arr = (double*)malloc( num_arr*sizeof(double) ); xmlExtractDoubleArray( low_node, ',', arr, num_arr ); int num_lower = num_arr/2; lower_curve.init(num_lower); for ( i = 0 ; i < num_arr ; i+=2) { pnt = vec3d(arr[i], 0.0, arr[i+1]); lower_curve.load_pnt( i/2, pnt ); } free(arr); } } set_type(temp_type); }
double GasMixture_Impl::getThermalConductance(double temperature) const { return getThermalConductivity(temperature)/thickness(); }
//===== Load Wedge Upper & Lower Hermite Curves =====// void Af::load_wedge_curves() { int i; int apex; double x, xu, zu, xl, zl, a, b; //==== Initialize Array For Points ====// int half_pnts = num_pnts/2; upper_curve.init(half_pnts+1); lower_curve.init(half_pnts+1); half_pnts = num_pnts/2; apex = (int)( (float)half_pnts*thickness_loc()) + 1; if ( half_pnts == apex ) apex--; //==== Compute Front Side Points ====// for ( i = 1 ; i < apex ; i++) { //==== Linear Distribution of Points ====// x = (float)i / (float)apex * thickness_loc(); //==== Compute Upper Surface Points ====// a = 0.5*thickness()/thickness_loc(); xu = x; zu = a*xu; upper_curve.load_pnt( i, vec3d(xu, 0.0, zu) ); //==== Compute Lower Surface Points ====// xl = xu; zl = - zu; lower_curve.load_pnt( i, vec3d(xl, 0.0, zl) ); } //==== Compute Back Side Points ====// for ( i = apex ; i < half_pnts ; i++) { //==== Linear Distribution of Points ====// x = (float) (i - apex) / (float) (half_pnts - apex) * (1.0 - thickness_loc()) + thickness_loc(); //==== Compute Upper Surface Points ====// a = -0.5*thickness()/(1.0 - thickness_loc()); b = -a; xu = x; zu = a*xu + b; upper_curve.load_pnt( i, vec3d(xu, 0.0, zu) ); //==== Compute Lower Surface Points ====// xl = xu; zl = - zu; lower_curve.load_pnt( i, vec3d(xl, 0.0, zl) ); } upper_curve.load_pnt(0, vec3d(0.0, 0.0, 0.0) ); upper_curve.load_pnt(half_pnts, vec3d(1.0, 0.0, 0.0) ); lower_curve.load_pnt(0, vec3d(0.0, 0.0, 0.0) ); lower_curve.load_pnt(half_pnts, vec3d(1.0, 0.0, 0.0) ); upper_curve.comp_tans(); lower_curve.comp_tans(); }
Quantity GasMixture_Impl::getThickness(bool returnIP) const { OptionalDouble value = thickness(); OSOptionalQuantity result = getQuantityFromDouble(OS_WindowMaterial_GasMixtureFields::Thickness, value, returnIP); OS_ASSERT(result.isSet()); return result.get(); }
//===== Read AF File =====// int Af::read_af_file( Stringc file_name ) { Stringc line; char buff[255]; int thickness_read_flag = 0; int radius_le_read_flag = 0; int radius_te_read_flag = 0; /* --- Open file --- */ FILE* file_id = fopen(file_name, "r"); if (file_id == (FILE *)NULL) return(0); fgets(buff, 255, file_id); line = buff; int ok = 0; if (line.search_for_substring("AIRFOIL FILE") < 0) { ok = readSeligAirfoil( file_id ); if ( ok ) { name = buff; name.remove_trailing_blanks(); name.remove_all_substrings('\n'); name.remove_all_substrings('\r'); } else { ok = readLednicerAirfoil( file_id ); } } else { ok = readVspAirfoil( file_id, &thickness_read_flag, &radius_le_read_flag, &radius_te_read_flag ); } fclose( file_id ); if ( !ok ) return 0; //==== Set Type and Deactivate Parameters ====// set_type( AIRFOIL_FILE ); //==== Check if Thickness was in File - Compute if not ====// if ( !thickness_read_flag ) thickness = compute_thickness_af_curves(); //==== Set Base Thickness Value ====// orig_af_thickness = (float)thickness(); //==== Check if Radius LE was in File - Compute if not ====// if ( !radius_le_read_flag ) { radius_le = compute_radius_le_af_curves(); radius_le_correction_factor = 1.0; } else { radius_le_correction_factor = (float)(radius_le()/compute_radius_le_af_curves()); } //==== Check if Radius TE was in File - Compute if not ====// if ( !radius_te_read_flag ) { radius_te = 0.0; } upper_curve.comp_tans(); lower_curve.comp_tans(); vec3d leading_edge_tan = vec3d(0.0, 0.0, 1.0); double tan_mag = upper_curve.get_tan(0).mag(); upper_curve.load_tan( 0, leading_edge_tan*tan_mag); tan_mag = -(lower_curve.get_tan(0).mag()); lower_curve.load_tan( 0, leading_edge_tan*tan_mag); generate_from_file_curve(); return(1); }
hkpRigidBody* CrashTestDummiesDemo::createSimpleCarHull() { // Create the shape and a rigid body to view it. hkpShape* carShape; { // Data specific to this shape. int numVertices[2] = {8, 10}; // 16 = 4 (size of "each float group", 3 for x,y,z, 1 for padding) * 4 (size of float) int stride = sizeof(float) * 4; float vertices[2][10*4] = { { // 4 vertices plus padding 0.00f, 0.00f, 0.00f, 0.00f, 0.55f, 0.00f, 0.00f, 0.00f, 0.05f, 0.00f, 0.40f, 0.00f, 0.45f, 0.00f, 0.40f, 0.00f, 0.00f, 2.00f, 0.00f, 0.00f, 0.55f, 2.00f, 0.00f, 0.00f, 0.05f, 2.00f, 0.40f, 0.00f, 0.45f, 2.00f, 0.40f, 0.00f }, { 0.00f, 0.00f, 0.00f, 0.00f, 0.05f, 0.00f, 0.40f, 0.00f, 0.00f, 0.00f, 0.80f, 0.00f, -0.05f, 0.00f, 0.80f, 0.00f, -0.05f, 0.00f, 0.00f, 0.00f, 0.00f, 2.00f, 0.00f, 0.00f, 0.05f, 2.00f, 0.40f, 0.00f, 0.00f, 2.00f, 0.80f, 0.00f, -0.05f, 2.00f, 0.80f, 0.00f, -0.05f, 2.00f, 0.00f, 0.00f, } }; /////////////////// SHAPE CONSTRUCTION //////////////// hkArray<hkpShape*> shapes; { { for (int i = 0; i < 2; i++) { hkStridedVertices stridedVerts; { stridedVerts.m_numVertices = numVertices[i]; stridedVerts.m_striding = stride; stridedVerts.m_vertices = vertices[i]; } hkGeometry geom; hkArray<hkVector4> planeEquations; hkGeometryUtility::createConvexGeometry( stridedVerts, geom, planeEquations ); { stridedVerts.m_numVertices = geom.m_vertices.getSize(); stridedVerts.m_striding = sizeof(hkVector4); stridedVerts.m_vertices = &(geom.m_vertices[0](0)); } hkpConvexVerticesShape* shape = new hkpConvexVerticesShape(stridedVerts, planeEquations); shape->setRadius(0.01f); hkpConvexTranslateShape* tshape = new hkpConvexTranslateShape(shape, hkVector4(1.5f, 0.0f, 0.0f)); shapes.pushBack(shape); shapes.pushBack(tshape); } } /////////////////////////////////////////////////////// { hkVector4 carDim(4.5f, 2.0f, 1.7f); carDim.mul4(0.5f); hkReal thick = 0.03f; hkVector4 thickness(thick, thick, thick); for (int i = 0; i < 3; i++) { hkVector4 halfExt; halfExt.setZero4(); halfExt(i) = carDim(i); halfExt((i+1)%3) = carDim((i+1)%3); halfExt.add4(thickness); hkpBoxShape* box = new hkpBoxShape(halfExt, 0.01f); hkVector4 shift; shift.setZero4(); shift((i+2)%3) = carDim((i+2)%3); hkVector4 transl[2]; transl[0].setAdd4(carDim, shift); transl[1].setSub4(carDim, shift); hkpConvexTranslateShape* tbox = new hkpConvexTranslateShape(box, transl[0]); shapes.pushBack(tbox); tbox = new hkpConvexTranslateShape(box, transl[1]); shapes.pushBack(tbox); box->removeReference(); } } } hkpListShape* listShape = new hkpListShape(shapes.begin(), shapes.getSize()); carShape = listShape; for (int s = 0; s < shapes.getSize(); s++) { shapes[s]->removeReference(); } /////////////////////////////////////// // Optionally Construct MOPP around list if(0) { hkpMoppCompilerInput moppInput; moppInput.setAbsoluteFitToleranceOfTriangles(0.01f); hkpMoppCode* code = hkpMoppUtility::buildCode(listShape, moppInput); carShape = new hkpMoppBvTreeShape(listShape, code); listShape->removeReference(); code->removeReference(); } } // create the rigid body hkpRigidBody* rigidBody; { // To illustrate using the shape, create a rigid body by first defining a template. hkpRigidBodyCinfo rigidBodyInfo; rigidBodyInfo.m_shape = carShape; rigidBodyInfo.m_position.set(0.0f, 0.0f, 0.0f); rigidBodyInfo.m_angularDamping = 0.0f; rigidBodyInfo.m_linearDamping = 0.0f; hkReal mass = 100.0f; hkpInertiaTensorComputer::setShapeVolumeMassProperties(carShape, mass, rigidBodyInfo); rigidBodyInfo.m_motionType = hkpMotion::MOTION_DYNAMIC; rigidBodyInfo.m_friction = 1.0f; rigidBodyInfo.m_qualityType = HK_COLLIDABLE_QUALITY_CRITICAL; // Create a rigid body rigidBody = new hkpRigidBody(rigidBodyInfo); // Remove reference since the body now "owns" the Shape. rigidBodyInfo.m_shape->removeReference(); } return rigidBody; }