本文整理汇总了C++中Geom类的典型用法代码示例。如果您正苦于以下问题:C++ Geom类的具体用法?C++ Geom怎么用?C++ Geom使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Geom类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFeaStruct
void StructureMgrSingleton::ShowAllParts()
{
FeaStructure* fea_struct = GetFeaStruct( m_CurrStructIndex );
Vehicle* veh = VehicleMgr.GetVehicle();
if ( fea_struct && veh )
{
string parent_id = fea_struct->GetParentGeomID();
veh->HideAll();
Geom* parent = veh->FindGeom( parent_id );
if ( parent )
{
parent->SetSetFlag( 1, true ); //add to shown
parent->SetSetFlag( 2, false ); //remove from show
}
vector < FeaPart* > part_vec = fea_struct->GetFeaPartVec();
for ( size_t i = 0; i < part_vec.size(); i++ )
{
part_vec[i]->m_DrawFeaPartFlag.Set( true );
}
vector < SubSurface* > ss_vec = fea_struct->GetFeaSubSurfVec();
for ( size_t i = 0; i < ss_vec.size(); i++ )
{
ss_vec[i]->m_DrawFeaPartFlag.Set( true );
}
}
}
示例2: GetDlgItems
void TreeDlg::OnTreeComputePath()
{
GetDlgItems();
ClearOutputText();
HTREEITEM hSelectedItem = mpTreeCtrl->GetSelectedItem();
if (hSelectedItem == NULL)
AppendOutputText("No item is selected");
else
{
GvPath *selectedItemPath = PathOfItem(hSelectedItem);
if (selectedItemPath == NULL)
AppendOutputText("[PathOfItem(...) returned NULL");
else
{
UtScalarArray<int> *indexArray = selectedItemPath->GetIndexArray();
int count = selectedItemPath->GetIndexCount();
AppendOutputText("Selected ");
Geom *g = selectedItemPath->Resolve();
AppendOutputText(g->GetType()->mpName);
AppendOutputText(" at path");
char buf[20];
for (int i=0; i<count; ++i) {
sprintf(buf, " %d", (*indexArray)[i]);
AppendOutputText(buf);
}
}
}
}
示例3: GetCumulativeTransform
void GvPath::GetCumulativeTransform(Transform3 *T)
{
T->Identity();
int i;
for (i=0; i<mAncestryLength; ++i) {
Geom *g = mAncestry[i];
if (g->IsInstanceOf(TYPE_INFO(GeomWrapped))) {
Transform3 *M = ((GeomWrapped*)g)->GetTransform();
// Explanation of the order of multiplication: Our
// transform libarary treats data points as row vectors;
// transforms act on them by right multiplication, i.e.
// [point] * [matrix] = [new point]. Transforms lower in
// the heirarchy are closer to the data points (the one
// just above the leaf node Geom being the one that acts
// on it first), so the order in which the product of
// transformations act on a point is:
// [point] * [transf n] * ... * [transf 1] * [transf 0]
// = [new point]
// At this point, we've accumulated the product
// [transf i-1] ... [transf 0]
// in T, and we're about to multiply it by [transf i]
// (which is in M), so the order should be M * T.
T->Concat(M, T);
}
}
}
示例4: Update
void VSPAEROMgrSingleton::Update()
{
if( m_RefFlag() == MANUAL_REF )
{
m_Sref.Activate();
m_bref.Activate();
m_cref.Activate();
}
else
{
Geom* refgeom = VehicleMgr.GetVehicle()->FindGeom( m_RefGeomID );
if( refgeom )
{
if( refgeom->GetType().m_Type == MS_WING_GEOM_TYPE )
{
WingGeom* refwing = (WingGeom*) refgeom;
m_Sref.Set( refwing->m_TotalArea() );
m_bref.Set( refwing->m_TotalSpan() );
m_cref.Set( refwing->m_TotalChord() );
m_Sref.Deactivate();
m_bref.Deactivate();
m_cref.Deactivate();
}
}
}
}
示例5: GetGeom
//==== Get copy of sub surfaces from geom by id and surf number ====//
vector< SubSurface*> SubSurfaceMgrSingleton::GetSubSurfs( string comp_id, int surfnum )
{
vector< SubSurface* > ret_vec;
Geom* geom = GetGeom( comp_id );
if ( !geom )
{
return ret_vec;
}
vector< SubSurface* > all_vec;
all_vec = geom->GetSubSurfVec();
int imain = geom->GetMainSurfID( surfnum );
for ( int i = 0; i < all_vec.size(); i++ )
{
if ( imain == all_vec[i]->m_MainSurfIndx() )
{
ret_vec.push_back( all_vec[i] );
}
}
return ret_vec;
}
示例6: NoShowActiveGeoms
//==== Show/NoShow Active Geoms and Children ====//
void ManageGeomScreen::NoShowActiveGeoms( bool flag )
{
//==== Load Active Geom IDs And Children ====//
vector<string> geom_id_vec;
vector<string> active_geom_vec = m_VehiclePtr->GetActiveGeomVec();
for ( int i = 0 ; i < ( int )active_geom_vec.size() ; i++ )
{
Geom* gPtr = m_VehiclePtr->FindGeom( active_geom_vec[i] );
if ( gPtr )
{
gPtr->LoadIDAndChildren( geom_id_vec );
}
}
//==== Set No Show Flag ====//
vector< Geom* > geom_vec = m_VehiclePtr->FindGeomVec( geom_id_vec );
for ( int i = 0 ; i < ( int )geom_vec.size() ; i++ )
{
if ( geom_vec[i] )
{
geom_vec[i]->SetSetFlag( SET_SHOWN , !flag );
geom_vec[i]->SetSetFlag( SET_NOT_SHOWN , flag );
}
}
//jrg FIX!!!
// aircraftPtr->triggerDraw();
LoadBrowser();
}
示例7: DeleteGeoms
void ModelBody::RebuildCollisionMesh()
{
if (m_geom) {
if (GetFrame()) RemoveGeomsFromFrame(GetFrame());
DeleteGeoms();
}
m_collMesh = m_model->GetCollisionMesh();
SetPhysRadius(m_collMesh->GetAabb().GetRadius());
//static geom
m_geom = new Geom(m_collMesh->GetGeomTree());
m_geom->SetUserData(static_cast<void*>(this));
m_geom->MoveTo(GetOrient(), GetPosition());
//have to figure out which collision geometries are responsible for which geomtrees
DynGeomFinder dgf;
m_model->GetRoot()->Accept(dgf);
//dynamic geoms
for (auto it = m_collMesh->GetDynGeomTrees().begin(); it != m_collMesh->GetDynGeomTrees().end(); ++it) {
Geom *dynG = new Geom(*it);
dynG->SetUserData(static_cast<void*>(this));
dynG->MoveTo(GetOrient(), GetPosition());
dynG->m_animTransform = matrix4x4d::Identity();
SceneGraph::CollisionGeometry *cg = dgf.GetCgForTree(*it);
if (cg)
cg->SetGeom(dynG);
m_dynGeoms.push_back(dynG);
}
if (GetFrame()) AddGeomsToFrame(GetFrame());
}
示例8: SetupCustomDefaultSource
void CustomGeomMgrSingleton::SetupCustomDefaultSource( int type, int surf_index,
double l1, double r1, double u1, double w1,
double l2, double r2, double u2, double w2 )
{
Geom* gptr = VehicleMgr.GetVehicle()->FindGeom( m_CurrGeom );
//==== Check If Geom is Valid and Correct Type ====//
if ( gptr && gptr->GetType().m_Type == CUSTOM_GEOM_TYPE )
{
CustomGeom* custom_geom = dynamic_cast<CustomGeom*>( gptr );
SourceData sd;
sd.m_Type = type;
sd.m_SurfIndex = surf_index;
sd.m_Len1 = l1;
sd.m_Rad1 = r1;
sd.m_U1 = u1;
sd.m_W1 = w1;
sd.m_Len2 = l2;
sd.m_Rad2 = r2;
sd.m_U2 = u2;
sd.m_W2 = w2;
custom_geom->SetUpDefaultSource( sd );
}
}
示例9: init_fn_ord
double KellyTypeAdapt::eval_boundary_estimator(KellyTypeAdapt::ErrorEstimatorForm* err_est_form, RefMap *rm, SurfPos* surf_pos)
{
// determine the integration order
int inc = (this->sln[err_est_form->i]->get_num_components() == 2) ? 1 : 0;
Func<Ord>** oi = new Func<Ord>* [num];
for (int i = 0; i < num; i++)
oi[i] = init_fn_ord(this->sln[i]->get_edge_fn_order(surf_pos->surf_num) + inc);
// Order of additional external functions.
ExtData<Ord>* fake_ext = dp.init_ext_fns_ord(err_est_form->ext, surf_pos->surf_num);
double fake_wt = 1.0;
Geom<Ord>* fake_e = init_geom_ord();
Ord o = err_est_form->ord(1, &fake_wt, oi, oi[err_est_form->i], fake_e, fake_ext);
int order = rm->get_inv_ref_order();
order += o.get_order();
limit_order(order);
// Clean up.
for (int i = 0; i < this->num; i++)
if (oi[i] != NULL) { oi[i]->free_ord(); delete oi[i]; }
delete [] oi;
delete fake_e;
delete fake_ext;
// eval the form
Quad2D* quad = this->sln[err_est_form->i]->get_quad_2d();
int eo = quad->get_edge_points(surf_pos->surf_num, order);
double3* pt = quad->get_points(eo);
int np = quad->get_num_points(eo);
// init geometry and jacobian*weights
Geom<double>* e = init_geom_surf(rm, surf_pos, eo);
double3* tan = rm->get_tangent(surf_pos->surf_num, eo);
double* jwt = new double[np];
for(int i = 0; i < np; i++)
jwt[i] = pt[i][2] * tan[i][2];
// function values
Func<scalar>** ui = new Func<scalar>* [num];
for (int i = 0; i < num; i++)
ui[i] = init_fn(this->sln[i], eo);
ExtData<scalar>* ext = dp.init_ext_fns(err_est_form->ext, rm, eo);
scalar res = boundary_scaling_const *
err_est_form->value(np, jwt, ui, ui[err_est_form->i], e, ext);
for (int i = 0; i < this->num; i++)
if (ui[i] != NULL) { ui[i]->free_fn(); delete ui[i]; }
delete [] ui;
if (ext != NULL) { ext->free(); delete ext; }
e->free(); delete e;
delete [] jwt;
return std::abs(0.5*res); // Edges are parameterized from 0 to 1 while integration weights
// are defined in (-1, 1). Thus multiplying with 0.5 to correct
// the weights.
}
示例10: in_pose
void FourWheeler::create(World* in_world, Pose3D in_pose3D)
{
// TODO use full position data
Pose in_pose(in_pose3D.point().x(), in_pose3D.point().y(), Deg(0));
msg::Subs<num::Pose> pose(m_pChannel,"true-pose");
msg::Subs<num::Speed, FourWheeler> reqSpeed(m_pChannel,"speed-requested", this, &FourWheeler::reqSpeed);
msg::Subs<num::Speed> currentSpeed(m_pChannel, "speed-current");
pose.value = in_pose;
m_pSpace = new SimpleSpace(in_world->getSpace());
m_pChassis = new Body(in_world);
m_pChassis->setPosition(in_pose.x().m(),in_pose.y().m(),STARTZ().m());
m_pChassisBox = new BoxGeom(m_pChassis, m_pSpace, ROBOT_LENGTH().m(),ROBOT_WIDTH().m(),ROBOT_HEIGHT().m());
m_pChassisBox->setMass(CHASSIS_MASS());
m_wheels = new Body[4];
for (int i = 0; i < 4; i++)
{
m_wheels[i].create(in_world);
dQuaternion q;
dQFromAxisAndAngle (q,1,0,0,M_PI*0.5);
m_wheels[i].setQuaternion(q);
Geom* geom = new SphereGeom(&m_wheels[i], m_pSpace, RADIUS().m());
geom->setMass(WMASS());
// Magic number (see Pisvejc): make it too big, and turning won't be possible, make it too small, and
// robot will just stay on place, regardless of how fast wheels are turning
geom->m_contactData.mu = 0.75;
}
m_wheels[0].setPosition(in_pose.x().m()+0.4*ROBOT_LENGTH().m(),
in_pose.y().m()+0.5*ROBOT_WIDTH().m(),STARTZ().m()-0.5*ROBOT_HEIGHT().m());
m_wheels[1].setPosition(in_pose.x().m()+0.4*ROBOT_LENGTH().m(),
in_pose.y().m()-0.5*ROBOT_WIDTH().m(),STARTZ().m()-0.5*ROBOT_HEIGHT().m());
m_wheels[2].setPosition(in_pose.x().m()-0.4*ROBOT_LENGTH().m(),
in_pose.y().m()+0.5*ROBOT_WIDTH().m(),STARTZ().m()-0.5*ROBOT_HEIGHT().m());
m_wheels[3].setPosition(in_pose.x().m()-0.4*ROBOT_LENGTH().m(),
in_pose.y().m()-0.5*ROBOT_WIDTH().m(),STARTZ().m()-0.5*ROBOT_HEIGHT().m());
for (int i=0; i<4;i++)
{
m_joints[i] = new Hinge2Joint(in_world);
m_joints[i]->attach(m_pChassis,&m_wheels[i]);
double a[3];
m_wheels[i].getPosition(a);
m_joints[i]->setAnchor (a[0],a[1],a[2]);
m_joints[i]->setAxis1(0,0,(i<2 ? 1 : -1));
m_joints[i]->setAxis2(0,1,0);
m_joints[i]->setParam(dParamSuspensionERP,0.8);
m_joints[i]->setParam(dParamSuspensionCFM,1e-5);
m_joints[i]->setParam(dParamVel2,0);
m_joints[i]->setParam(dParamFMax2,FMAX());
m_joints[i]->setParam(dParamLoStop,0);
m_joints[i]->setParam(dParamHiStop,0);
}
}
示例11: init_fn_ord
scalar HcurlOrthoHP::eval_error(biform_val_t bi_fn, biform_ord_t bi_ord,
MeshFunction *sln1, MeshFunction *sln2, MeshFunction *rsln1, MeshFunction *rsln2,
RefMap *rv1, RefMap *rv2, RefMap *rrv1, RefMap *rrv2)
{
// determine the integration order
int inc = (rsln1->get_num_components() == 2) ? 1 : 0;
Func<Ord>* ou = init_fn_ord(rsln1->get_fn_order() + inc);
Func<Ord>* ov = init_fn_ord(rsln2->get_fn_order() + inc);
double fake_wt = 1.0;
Geom<Ord>* fake_e = init_geom_ord();
Ord o = bi_ord(1, &fake_wt, ou, ov, fake_e, NULL);
int order = rrv1->get_inv_ref_order();
order += o.get_order();
limit_order(order);
ou->free_ord(); delete ou;
ov->free_ord(); delete ov;
delete fake_e;
// eval the form
Quad2D* quad = sln1->get_quad_2d();
double3* pt = quad->get_points(order);
int np = quad->get_num_points(order);
// init geometry and jacobian*weights
Geom<double>* e = init_geom_vol(rrv1, order);
double* jac = rrv1->get_jacobian(order);
double* jwt = new double[np];
for(int i = 0; i < np; i++)
jwt[i] = pt[i][2] * jac[i];
// function values and values of external functions
Func<scalar>* err1 = init_fn(sln1, rv1, order);
Func<scalar>* err2 = init_fn(sln2, rv2, order);
Func<scalar>* v1 = init_fn(rsln1, rrv1, order);
Func<scalar>* v2 = init_fn(rsln2, rrv2, order);
for (int i = 0; i < np; i++)
{
err1->val0[i] = err1->val0[i] - v1->val0[i];
err1->val1[i] = err1->val1[i] - v1->val1[i];
err1->curl[i] = err1->curl[i] - v1->curl[i];
err2->val0[i] = err2->val0[i] - v2->val0[i];
err2->val1[i] = err2->val1[i] - v2->val1[i];
err2->curl[i] = err2->curl[i] - v2->curl[i];
}
scalar res = bi_fn(np, jwt, err1, err2, e, NULL);
e->free(); delete e;
delete [] jwt;
err1->free_fn(); delete err1;
err2->free_fn(); delete err2;
v1->free_fn(); delete v1;
v2->free_fn(); delete v2;
return res;
}
示例12: return
Transform3 *GvPath::GetLocalTransform()
{
if (mAncestryLength <= 1) { return &Transform3::IDENTITY; }
Geom *parent = mAncestry[mAncestryLength-2];
if (!parent->IsInstanceOf(TYPE_INFO(GeomWrapped))) {
return NULL;
}
return ((GeomWrapped*)parent)->GetTransform();
}
示例13: GetSelectedBrowserItems
//==== Item in Geom Browser Was Selected ====//
void ManageGeomScreen::GeomBrowserCallback()
{
//==== Find Vector of All Selections ====//
vector< string > selVec = GetSelectedBrowserItems();
//==== Find Last Selected Geom ====//
int last = m_GeomUI->geomBrowser->value();
if ( ( last >= 2 ) && Fl::event_state( FL_ALT ) ) // Select Children
{
Geom* lastSelGeom = m_VehiclePtr->FindGeom( m_DisplayedGeomVec[last - 2] );
if ( lastSelGeom )
{
vector<string> cVec;
lastSelGeom->LoadIDAndChildren( cVec );
for ( int i = 1 ; i < ( int )cVec.size(); i++ )
{
SelectGeomBrowser( cVec[i] );
selVec.push_back( cVec[i] );
}
}
}
//==== Check if Geom Already Selected ====//
m_CollapseFlag = false;
if ( m_LastSelectedGeomID != "NONE" && selVec.size() == 1 )
{
string lastSel = selVec[0];
if ( lastSel == m_LastSelectedGeomID )
{
m_CollapseFlag = true;
Geom* lastSelGeom = m_VehiclePtr->FindGeom( m_LastSelectedGeomID );
if ( lastSelGeom )
{
lastSelGeom->m_GuiDraw.ToggleDisplayChildrenFlag();
if ( lastSelGeom->GetChildIDVec().size() == 0 ) // No Children Dont Collapse
{
lastSelGeom->m_GuiDraw.SetDisplayChildrenFlag( true );
}
}
}
}
m_LastSelectedGeomID = "NONE";
if ( selVec.size() == 1 )
{
m_LastSelectedGeomID = selVec[0];
}
m_VehiclePtr->SetActiveGeomVec( selVec );
LoadActiveGeomOutput();
// m_ScreenMgr->UpdateAllScreens();
ShowHideGeomScreens();
//jrg FIX!!!
// aircraftPtr->triggerDraw();
}
示例14: CheckClearTriggerEvent
//===== Check And Clear Trigger Event ====//
bool CustomGeomMgrSingleton::CheckClearTriggerEvent( int gui_id )
{
Geom* gptr = VehicleMgr.GetVehicle()->FindGeom( m_CurrGeom );
//==== Check If Geom is Valid and Correct Type ====//
if ( gptr && gptr->GetType().m_Type == CUSTOM_GEOM_TYPE )
{
CustomGeom* custom_geom = dynamic_cast<CustomGeom*>( gptr );
return custom_geom->CheckClearTriggerEvent( gui_id );
}
return false;
}
示例15: RemoveXSecSurf
//==== Remove XSec Surface To Current Geom ====//
void CustomGeomMgrSingleton::RemoveXSecSurf( const string& id )
{
Geom* gptr = VehicleMgr.GetVehicle()->FindGeom( m_CurrGeom );
//==== Check If Geom is Valid and Correct Type ====//
if ( gptr && gptr->GetType().m_Type == CUSTOM_GEOM_TYPE )
{
CustomGeom* custom_geom = dynamic_cast<CustomGeom*>( gptr );
custom_geom->RemoveXSecSurf( id );
}
}