本文整理汇总了C++中ON_Xform::Translation方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_Xform::Translation方法的具体用法?C++ ON_Xform::Translation怎么用?C++ ON_Xform::Translation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_Xform
的用法示例。
在下文中一共展示了ON_Xform::Translation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Translate
bool ON_Plane::Translate(
const ON_3dVector& delta
)
{
ON_Xform tr;
tr.Translation( delta );
return Transform( tr );
}
示例2: Translate
ON_BOOL32 ON_Geometry::Translate( const ON_3dVector& delta )
{
if ( delta.IsZero() )
return true;
ON_Xform tr;
tr.Translation( delta );
return Transform( tr );
}
示例3: RunCommand
CRhinoCommand::result CTraslRuota::RunCommand( const CRhinoCommandContext& context )
{
Cscript1PlugIn& plugin = script1PlugIn();
if( !plugin.IsDlgVisible() )
{
return CRhinoCommand::nothing;
}
/*GET A REFERENCE TO THE LAYER TABLE*/
CRhinoLayerTable& layer_table = context.m_doc.m_layer_table;
ON_Layer currentLayer;
int numLayers = layer_table.LayerCount();
for(int i = 0; i < numLayers; i++)
{
currentLayer = layer_table[i];
const CRhinoLayer& layer = layer_table[i];
currentLayer.SetVisible(true);
layer_table.ModifyLayer(currentLayer, i);
layer_table.SetCurrentLayerIndex(i);
const CRhinoLayer& current_layer = layer_table.CurrentLayer();
int layer_index = layer_table.CurrentLayerIndex();
const CRhinoLayer& layer2 = layer_table[layer_index];
ON_SimpleArray<CRhinoObject*> obj_list;
int j, obj_count = context.m_doc.LookupObject( layer2, obj_list );
for( j = 0; j < obj_count; j++ )
{
CRhinoObject* obj = obj_list[j];
if( obj && obj->IsSelectable() )
obj->Select();
if( obj_count )
context.m_doc.Redraw();
}
}
context.m_doc.Redraw();
//inizio rotazione
double m_angle=(_wtof(plugin.m_dialog->ValoreRotazione));
ON_Plane plane = RhinoActiveCPlane();
CRhinoGetObject go1;
go1.GetObjects( 1, 0 );
int numero1 = go1.ObjectCount();
for( int k = 0; k < go1.ObjectCount(); k++ )
{
// Get an object reference
const CRhinoObjRef& ref = go1.Object(k);
// Get the real object
const CRhinoObject* obj = ref.Object();
if( !obj )
continue;
ON_Xform xform;
xform.Rotation( m_angle * ON_PI / 180.0, plane.zaxis, plane.Origin() );
context.m_doc.TransformObject( obj, xform, true, true, true );
context.m_doc.Redraw();
}
//fine rotazione
//inizio traslazione
CRhinoGetObject go;
int numero = go.ObjectCount();
go.GetObjects( 1, 0 );
for( int i = 0; i < go.ObjectCount(); i++ )
{
// Get an object reference
const CRhinoObjRef& ref = go.Object(i);
// Get the real object
const CRhinoObject* obj = ref.Object();
if( !obj )
continue;
ON_Xform xform;
xform.Rotation( m_angle * ON_PI / 180.0, plane.zaxis, plane.Origin() );
//context.m_doc.TransformObject( obj, xform, true, true, true );
context.m_doc.Redraw();
xform.Translation((_wtof(plugin.m_dialog->ValoreTraslazione)),0,0);
context.m_doc.TransformObject( obj, xform, true, true, true );
//.........这里部分代码省略.........
示例4: ON_BrepExtrude
bool ON_BrepExtrude(
ON_Brep& brep,
const ON_Curve& path_curve,
bool bCap
)
{
ON_Workspace ws;
const int vcount0 = brep.m_V.Count();
const int tcount0 = brep.m_T.Count();
const int lcount0 = brep.m_L.Count();
const int ecount0 = brep.m_E.Count();
const int fcount0 = brep.m_F.Count();
const ON_3dPoint PathStart = path_curve.PointAtStart();
ON_3dPoint P = path_curve.PointAtEnd();
if ( !PathStart.IsValid() || !P.IsValid() )
return false;
const ON_3dVector height = P - PathStart;
if ( !height.IsValid() || height.Length() <= ON_ZERO_TOLERANCE )
return false;
ON_Xform tr;
tr.Translation(height);
// count number of new sides
int side_count = 0;
int i, vi, ei, fi;
bool* bSideEdge = (bool*)ws.GetIntMemory(ecount0*sizeof(bSideEdge[0]));
for ( ei = 0; ei < ecount0; ei++ )
{
const ON_BrepEdge& e = brep.m_E[ei];
if ( 1 == e.m_ti.Count() )
{
side_count++;
bSideEdge[ei] = true;
}
else
{
bSideEdge[ei] = false;
}
}
brep.m_V.Reserve( 2*vcount0 );
i = 4*side_count + (bCap?tcount0:0);
brep.m_T.Reserve( tcount0 + i );
brep.m_C2.Reserve( brep.m_C2.Count() + i );
brep.m_L.Reserve( lcount0 + side_count + (bCap?lcount0:0) );
i = side_count + (bCap?ecount0:side_count);
brep.m_E.Reserve( ecount0 + i );
brep.m_C3.Reserve( brep.m_C3.Count() + i );
i = side_count + (bCap?fcount0:0);
brep.m_F.Reserve( fcount0 + i );
brep.m_S.Reserve( brep.m_S.Count() + i );
bool bOK = true;
// build top vertices
int* topvimap = ws.GetIntMemory(vcount0);
memset(topvimap,0,vcount0*sizeof(topvimap[0]));
if ( bCap )
{
for ( vi = 0; vi < vcount0; vi++ )
{
const ON_BrepVertex& bottomv = brep.m_V[vi];
ON_BrepVertex& topv = brep.NewVertex(bottomv.point+height,bottomv.m_tolerance);
topvimap[vi] = topv.m_vertex_index;
}
}
else
{
for ( ei = 0; ei < ecount0; ei++ )
{
if ( bSideEdge[ei] )
{
const ON_BrepEdge& bottome = brep.m_E[ei];
int bottomvi0 = bottome.m_vi[0];
if ( bottomvi0 < 0 || bottomvi0 >= vcount0 )
{
bOK = false;
break;
}
int bottomvi1 = bottome.m_vi[1];
if ( bottomvi1 < 0 || bottomvi1 >= vcount0 )
{
bOK = false;
break;
}
if ( !topvimap[bottomvi0] )
{
const ON_BrepVertex& bottomv = brep.m_V[bottomvi0];
ON_BrepVertex& topv = brep.NewVertex(bottomv.point+height,bottomv.m_tolerance);
topvimap[bottomvi0] = topv.m_vertex_index;
}
if ( !topvimap[bottomvi1] )
{
const ON_BrepVertex& bottomv = brep.m_V[bottomvi1];
ON_BrepVertex& topv = brep.NewVertex(bottomv.point+height,bottomv.m_tolerance);
topvimap[bottomvi1] = topv.m_vertex_index;
}
}
//.........这里部分代码省略.........