本文整理汇总了C++中BaseObject::SetRelRot方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseObject::SetRelRot方法的具体用法?C++ BaseObject::SetRelRot怎么用?C++ BaseObject::SetRelRot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseObject
的用法示例。
在下文中一共展示了BaseObject::SetRelRot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Recurse
// go through every (child) object
static Bool Recurse(HierarchyHelp *hh, BaseThread *bt, BaseObject *main, BaseObject *op, const Matrix &ml, Real srad, Real crad, LONG sub, Bool single)
{
// test if input object if polygonal
if (op->GetType()==Opolygon)
{
BaseObject *tp = NULL;
PolyInfo *pli = NULL;
const Vector *padr = ToPoly(op)->GetPointR();
Vector pa,pb;
LONG pcnt = ToPoly(op)->GetPointCount(),i,side,a=0,b=0;
const CPolygon *vadr = ToPoly(op)->GetPolygonR();
LONG vcnt = ToPoly(op)->GetPolygonCount();
Matrix m;
Neighbor n;
// load names from resource
String pstr = GeLoadString(IDS_ATOM_POINT);
String estr = GeLoadString(IDS_ATOM_EDGE);
// initialize neighbor class
if (!n.Init(pcnt,vadr,vcnt,NULL)) return FALSE;
// create separate objects
// if this option is enabled no polygonal geometry is build - more parametric objects
// are returned instead
if (single)
{
for (i=0; i<pcnt; i++)
{
// alloc sphere primitive
tp=BaseObject::Alloc(Osphere);
if (!tp) return FALSE;
// add phong tag
if (!tp->MakeTag(Tphong)) return FALSE;
tp->SetName(pstr+" "+LongToString(i));
// set object parameters
BaseContainer *bc = tp->GetDataInstance();
bc->SetReal(PRIM_SPHERE_RAD,srad);
bc->SetReal(PRIM_SPHERE_SUB,sub);
// insert as last object under main
tp->InsertUnderLast(main);
// set position in local coordinates
tp->SetRelPos(padr[i]*ml);
}
for (i=0; i<vcnt; i++)
{
// get polygon info for i-th polygon
pli = n.GetPolyInfo(i);
for (side=0; side<4; side++)
{
// only proceed if edge has not already been processed
// and edge really exists (for triangles side 2 from c..d does not exist as c==d)
if (pli->mark[side] || side==2 && vadr[i].c==vadr[i].d) continue;
// alloc cylinder primitive
tp=BaseObject::Alloc(Ocylinder);
if (!tp) return FALSE;
// add phong tag
if (!tp->MakeTag(Tphong)) return FALSE;
switch (side)
{
case 0: a=vadr[i].a; b=vadr[i].b; break;
case 1: a=vadr[i].b; b=vadr[i].c; break;
case 2: a=vadr[i].c; b=vadr[i].d; break;
case 3: a=vadr[i].d; b=vadr[i].a; break;
}
tp->SetName(estr+" "+LongToString(pli->edge[side]));
pa = padr[a]*ml;
pb = padr[b]*ml;
// set object parameters
BaseContainer *bc = tp->GetDataInstance();
bc->SetReal(PRIM_CYLINDER_RADIUS,crad);
bc->SetReal(PRIM_CYLINDER_HEIGHT,Len(pb-pa));
bc->SetReal(PRIM_AXIS,4);
bc->SetLong(PRIM_CYLINDER_CAPS,FALSE);
bc->SetLong(PRIM_CYLINDER_HSUB,1);
bc->SetLong(PRIM_CYLINDER_SEG,sub);
// place cylinder at edge center
tp->SetRelPos((pa+pb)*0.5);
// build edge matrix
m.v3=!(pb-pa);
RectangularSystem(m.v3,&m.v1,&m.v2);
tp->SetRelRot(MatrixToHPB(m, tp->GetRotationOrder()));
// insert as last object under main
tp->InsertUnderLast(main);
//.........这里部分代码省略.........