本文整理汇总了C++中IVector::set方法的典型用法代码示例。如果您正苦于以下问题:C++ IVector::set方法的具体用法?C++ IVector::set怎么用?C++ IVector::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVector
的用法示例。
在下文中一共展示了IVector::set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
HRESULT CVWScale3DTool::OnDoneScaling()
{
HRESULT hr = S_OK;
POSITION pos;
CTranslate3DObject * pCTrans = NULL;
IVector *pvPos = NULL;
for( pos = m_TransformList.GetHeadPosition(); pos != NULL; )
{
pCTrans = m_TransformList.GetNext( pos );
if(NULL != pCTrans)
{
pvPos = NULL;
if (FAILED(hr = pCTrans->m_pThing->get_ObjectProperty(bstrScale, (IObjectProperty**)&pvPos)))
goto FAIL_EXIT;
pvPos->set(pCTrans->currentLocation.x, pCTrans->currentLocation.y, pCTrans->currentLocation.z);
}
}
FAIL_EXIT:
SAFERELEASE(pvPos);
return hr;
}
示例2: Redo
STDMETHODIMP CVWExecuteGeomUndo::Redo( IVWUndoItem * predo )
{
HRESULT hr = S_OK;
VARIANT varTarget, varRedo;
IThing *pThing = NULL;
IVector *pvPos = NULL;
IVector *pvUp = NULL;
float fX, fY, fCenterX, fCenterY;
static CComBSTR bstrScale("Scale");
static CComBSTR bstrPosition("Position");
static CComBSTR bstrDirection("Direction");
static CComBSTR bstrUp("Up");
IBoundary *pEC = NULL;
IPropertyList *pBoundaryList = NULL;
UndoData *pud;
VARIANT_BOOL vbSafe;
int i;
VariantInit(&varTarget);
VariantInit(&varRedo);
hr = predo->get_UndoTarget(&varTarget);
if (FAILED(hr)) goto FAIL_EXIT;
hr = predo->get_UndoData(&varRedo);
if (FAILED(hr)) goto FAIL_EXIT;
pud = (UndoData*) varRedo.byref;
ASSERT(pud);
switch(pud->m_ot)
{
case SCALE:
pThing = (IThing*) varTarget.pdispVal;
ASSERT(pThing);
if (FAILED(hr = pThing->get_ObjectProperty(bstrScale, (IObjectProperty**)&pvPos)))
goto FAIL_EXIT;
pvPos->set(pud->extra.scale.newScale.x, pud->extra.scale.newScale.y, pud->extra.scale.newScale.z);
break;
case SCALE2D:
pEC = (IBoundary*) varTarget.pdispVal;
ASSERT(pEC);
fCenterX = pud->extra.scale.oldScale.x;
fCenterY = pud->extra.scale.oldScale.y;
i = 0;
while (TRUE)
{
hr = pEC->GetVertexXYExt(i, &fX, &fY);
if (hr == E_INVALIDARG)
{
hr = S_OK;
break;
}
if(FAILED( hr )) goto FAIL_EXIT;
hr = pEC->SetVertexXY(i, (fX - fCenterX) * pud->extra.scale.newScale.x + fCenterX, (fY - fCenterY) * pud->extra.scale.newScale.y + fCenterY);
if(FAILED( hr )) goto FAIL_EXIT;
i++;
}
break;
case TRANSLATE:
pThing = (IThing*) varTarget.pdispVal;
ASSERT(pThing);
if (FAILED(hr = pThing->get_ObjectProperty(bstrPosition, (IObjectProperty**)&pvPos)))
goto FAIL_EXIT;
pvPos->set(pud->extra.trans.newPosition.x, pud->extra.trans.newPosition.y, pud->extra.trans.newPosition.z);
break;
case TRANSLATE2D:
pEC = (IBoundary*) varTarget.pdispVal;
ASSERT(pEC);
if (pud->extra.trans.nSelectedVert >= 0)
{
//hr = pEC->Translate(pud->extra.trans.newPosition.x + fX, pud->extra.trans.newPosition.y + fY);
hr = pEC->Translate(pud->extra.trans.newPosition.x, pud->extra.trans.newPosition.y);
if (FAILED(hr)) goto FAIL_EXIT;
}
else //Move the whole Boundary
{
hr = pEC->Translate(pud->extra.trans.newPosition.x, pud->extra.trans.newPosition.y);
if (FAILED(hr)) goto FAIL_EXIT;
}
break;
case ROTATE:
pThing = (IThing*) varTarget.pdispVal;
ASSERT(pThing);
if (FAILED(hr = pThing->get_ObjectProperty(bstrDirection, (IObjectProperty**)&pvPos)))
goto FAIL_EXIT;
if (FAILED(hr = pThing->get_ObjectProperty(bstrUp, (IObjectProperty**)&pvUp)))
goto FAIL_EXIT;
pvPos->set(pud->extra.rotate.newDirection.x, pud->extra.rotate.newDirection.y, pud->extra.rotate.newDirection.z);
pvUp->set(pud->extra.rotate.newUp.x, pud->extra.rotate.newUp.y, pud->extra.rotate.newUp.z);
break;
case ROTATE2D:
//.........这里部分代码省略.........
示例3: if
//.........这里部分代码省略.........
}
hr = m_pRMCameraFrame->GetPosition(NULL, &vecCameraPos);
if (FAILED(hr)) goto EXIT_FAIL;
hr = CoCreateInstance(CLSID_Vector, NULL, CLSCTX_INPROC_SERVER, IID_IVector, (LPVOID*)&vecPtr);
if (FAILED(hr)) goto EXIT_FAIL;
hr = CoCreateInstance(CLSID_Vector, NULL, CLSCTX_INPROC_SERVER, IID_IVector, (LPVOID*)&vecDestPtr);
if (FAILED(hr)) goto EXIT_FAIL;
for( pos = m_TransformList.GetHeadPosition(); pos != NULL; )
{
pCTrans = m_TransformList.GetNext( pos );
if(pCTrans != NULL && pCTrans->m_pTrans != NULL)
{
hr = pCTrans->m_pVWFrame->get_Frame3D(&pRMObjFrame);
if (FAILED(hr) || (!pRMObjFrame)) goto EXIT_FAIL;
hr = pRMObjFrame->GetParent(&pRMParentFrame);
if (FAILED(hr) || (!pRMParentFrame)) goto EXIT_FAIL;
pRMObjFrame->GetPosition(NULL, &initialPos);
if (FAILED(hr)) goto EXIT_FAIL;
if (!IsPressed(VK_SHIFT))
{
vecObjToCam.x = initialPos.x - vecCameraPos.x;
vecObjToCam.y = 0.0f; //initialPos.y - vecCameraPos.y;
vecObjToCam.z = initialPos.z - vecCameraPos.z;
D3DRMVectorNormalize(&vecObjToCam);
vecPtr->set(vecObjToCam.x, vecObjToCam.y, vecObjToCam.z);
vecPtr->get_Rotation(&fRot);
if (fRot >= 0.785 && fRot <= 2.355)
{ //Camera is behind the object
}
else if (fRot >= 2.355 && fRot <= 3.925)
{ //Camera is left of the object
float fTmp;
fTmp = vecDelta.x;
vecDelta.x = vecDelta.z;
vecDelta.z = fTmp;
}
else if (fRot >= 3.925 && fRot <= 5.495)
{ //Camera is in front of the object
}
else
{ //Camera is right of the object
float fTmp;
fTmp = vecDelta.x;
vecDelta.x = vecDelta.z;
vecDelta.z = fTmp;
}
ComputeEulerAngles(pCTrans->m_pVWFrame, vecDestPtr);
vecDestPtr->get(&fX, &fY, &fZ);
if (fX >= 0.785 && fX <= 2.355)
{ //Camera is behind the object
fTmp = vecDelta.z;
vecDelta.z = vecDelta.y;