本文整理汇总了C++中Matrix3::SetTrans方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3::SetTrans方法的具体用法?C++ Matrix3::SetTrans怎么用?C++ Matrix3::SetTrans使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3
的用法示例。
在下文中一共展示了Matrix3::SetTrans方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: proc
int SphereObjCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat )
{
float r;
Point3 p1,center;
if (msg == MOUSE_FREEMOVE)
{
vpt->SnapPreview(m,m,NULL, SNAP_IN_3D);
}
if (msg==MOUSE_POINT||msg==MOUSE_MOVE)
{
switch(point)
{
case 0: // only happens with MOUSE_POINT msg
// Find the node and plug in the wire color
{
ULONG handle;
ob->NotifyDependents(FOREVER, (PartID)&handle, REFMSG_GET_NODE_HANDLE);
INode *node = GetCOREInterface()->GetINodeByHandle(handle);
if (node) node->SetWireColor(RGB(255, 0, 0));
}
ob->pblock2->SetValue(PB_RADIUS,0,0.0f);
ob->suspendSnap = TRUE;
sp0 = m;
p0 = vpt->SnapPoint(m,m,NULL,SNAP_IN_3D);
mat.SetTrans(p0);
break;
case 1:
mat.IdentityMatrix();
//mat.PreRotateZ(HALFPI);
p1 = vpt->SnapPoint(m,m,NULL,SNAP_IN_3D);
r = Length(p1-p0) / 7.0f;
mat.SetTrans(p0);
ob->pblock2->SetValue(PB_RADIUS,0,r);
ob->pmapParam->Invalidate();
if (flags&MOUSE_CTRL)
{
float ang = (float)atan2(p1.y-p0.y,p1.x-p0.x);
mat.PreRotateZ(ob->ip->SnapAngle(ang));
}
if (msg==MOUSE_POINT)
{
ob->suspendSnap = FALSE;
return (Length(m-sp0)<3 || Length(p1-p0)<0.1f)?CREATE_ABORT:CREATE_STOP;
}
break;
}
}
else
if (msg == MOUSE_ABORT)
{
return CREATE_ABORT;
}
return TRUE;
}
示例2: proc
int ProtHelpObjCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat )
{
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here
DbgAssert(!_T("Invalid viewport!"));
return FALSE;
}
if (msg==MOUSE_POINT||msg==MOUSE_MOVE) {
switch(point) {
case 0:
ph->suspendSnap = TRUE;
mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE));
break;
case 1:
mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE));
if (msg==MOUSE_POINT) {
ph->suspendSnap = FALSE;
return 0;
}
break;
}
} else if (msg == MOUSE_ABORT) {
return CREATE_ABORT;
}
return 1;
}
示例3: proc
int MorphObjCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat ) {
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here
DbgAssert(!_T("Invalid viewport!"));
return FALSE;
}
Point3 pt;
if (msg==MOUSE_POINT||msg==MOUSE_MOVE) {
switch(point) {
case 0: // only happens with MOUSE_POINT msg
pt = vpt->GetPointOnCP(m);
mat.SetTrans(pt);
break;
case 1:
pt = vpt->GetPointOnCP(m);
mat.SetTrans(pt);
if (msg==MOUSE_POINT)
return CREATE_STOP;
break;
}
}
else
if (msg == MOUSE_ABORT)
return CREATE_ABORT;
return TRUE;
}
示例4: proc
int TessendorfOceanCreateCallBack::proc(ViewExp *vpt,int msg, int point, int /*flags*/, IPoint2 m, Matrix3& mat )
{
//TODO: Implement the mouse creation code here
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here
DbgAssert(!_T("Invalid viewport!"));
return FALSE;
}
if (msg == MOUSE_POINT || msg == MOUSE_MOVE) {
switch(point) {
case 0: // only happens with MOUSE_POINT msg
ob->suspendSnap = TRUE;
sp0 = m;
p0 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
mat.SetTrans(p0);
//Set a default overall size in the parameter block
ob->pblock2->SetValue(pb_width, ob->ip->GetTime(), 0.0f);
ob->pblock2->SetValue(pb_length, ob->ip->GetTime(), 0.0f);
break;
case 1:
{
ob->suspendSnap = TRUE;
p1 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
Point3 diff = p1 - p0;
mat.SetTrans(p0 + diff / 2.0f);
//Set the overall size in parameter block
ob->pblock2->SetValue(pb_width, ob->ip->GetTime(), abs(diff.x));
ob->pblock2->SetValue(pb_length, ob->ip->GetTime(), abs(diff.y));
//Invalidate and display the mesh in the viewport
tessendorfocean_param_blk.InvalidateUI();
break;
}
case 2: // happens when user releases mouse
{
ob->suspendSnap = TRUE;
p1 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
Point3 diff = p1 - p0;
if (abs(diff.x) < MIN_WIDTH || abs(diff.y) < MIN_LENGTH)
{
return CREATE_ABORT; // abort if the size is too small
}
else
{
return CREATE_STOP;
}
}
}
} else {
if (msg == MOUSE_ABORT) return CREATE_ABORT;
}
return TRUE;
}
示例5: proc
int WindObjCreateCallback::proc(
ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat)
{
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here
DbgAssert(!_T("Invalid viewport!"));
return FALSE;
}
if (msg==MOUSE_POINT||msg==MOUSE_MOVE)
{
#ifdef _3D_CREATE
DWORD snapdim = SNAP_IN_3D;
#else
DWORD snapdim = SNAP_IN_PLANE;
#endif
switch(point)
{
case 0:
sp0 = m;
p0 = vpt->SnapPoint(m,m,NULL,snapdim);
mat.SetTrans(p0);
break;
case 1:
if (ob->ClassID()==Class_ID(GRAVITYOBJECT_CLASS_ID,0))
{
mat.IdentityMatrix();
mat.RotateX(PI);
mat.SetTrans(p0);
}
p1 = vpt->GetPointOnCP(m);
ob->pblock2->SetValue(PB_DISPLENGTH,0,Length(p1-p0)/2.0f);
// ob->pmapParam->Invalidate();
wind_param_blk.InvalidateUI();
if (msg==MOUSE_POINT)
{
if (Length(m-sp0)<3) return CREATE_ABORT;
else return CREATE_STOP;
}
break;
}
}
else
{
if (msg == MOUSE_ABORT)
{
return CREATE_ABORT;
}
else
if (msg == MOUSE_FREEMOVE)
{
vpt->SnapPreview(m,m);
}
}
return TRUE;
}
示例6: proc
//---------------------------------------------------------------------------
//
int LuminaireObjectCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat )
{
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here
DbgAssert(!_T("Invalid viewport!"));
return FALSE;
}
#ifdef _OSNAP
if (msg == MOUSE_FREEMOVE)
{
#ifdef _3D_CREATE
vpt->SnapPreview(m,m,NULL, SNAP_IN_3D);
#else
vpt->SnapPreview(m,m,NULL, SNAP_IN_PLANE);
#endif
}
#endif // _OSNAP
if (msg == MOUSE_POINT || msg == MOUSE_MOVE)
{
switch(point)
{
case 0:
{
mpObject->dumFlags |= CREATING; // tell object we're building it so we can disable snapping to itself
#ifdef _3D_CREATE
mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_3D));
#else
mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE));
#endif
break;
}
case 1:
#ifdef _3D_CREATE
mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_3D));
#else
mat.SetTrans(vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE));
#endif
if (msg == MOUSE_POINT)
{
mpObject->dumFlags &= ~CREATING;
return 0;
}
break;
}
}
else if (msg == MOUSE_ABORT)
{
mpObject->dumFlags &= ~CREATING;
return CREATE_ABORT;
}
return TRUE;
}
示例7: proc
int TriPatchCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat ) {
Point3 d;
#ifdef _OSNAP
if (msg == MOUSE_FREEMOVE)
{
#ifdef _3D_CREATE
vpt->SnapPreview(m,m,NULL, SNAP_IN_3D);
#else
vpt->SnapPreview(m,m,NULL, SNAP_IN_PLANE);
#endif
}
#endif
if (msg==MOUSE_POINT||msg==MOUSE_MOVE) {
switch(point) {
case 0:
sp0 = m;
ob->creating = 1; // tell object we're building it so we can disable snapping to itself
#ifdef _3D_CREATE
p0 = vpt->SnapPoint(m,m,NULL,SNAP_IN_3D);
#else
p0 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
#endif
ob->pblock->SetValue(PB_WIDTH,0,0.0f);
ob->pblock->SetValue(PB_LENGTH,0,0.0f);
p1 = p0 + Point3(0.01f,0.01f,0.0f);
mat.SetTrans(float(.5)*(p0+p1));
break;
case 1:
#ifdef _3D_CREATE
p1 = vpt->SnapPoint(m,m,NULL,SNAP_IN_3D);
#else
p1 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
#endif
mat.SetTrans(float(.5)*(p0+p1));
d = p1-p0;
ob->pblock->SetValue(PB_WIDTH,0,float(fabs(d.x)));
ob->pblock->SetValue(PB_LENGTH,0,float(fabs(d.y)));
ob->pmapParam->Invalidate();
if (msg==MOUSE_POINT) {
ob->creating = 0;
return (Length(m-sp0)<3) ? CREATE_ABORT: CREATE_STOP;
}
break;
}
}
else
if (msg == MOUSE_ABORT) {
ob->creating = 0;
return CREATE_ABORT;
}
return TRUE;
}
示例8: createmethod
int CreateSWrapObjectProc::createmethod(
ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat)
{ Point3 d;
#ifdef _3D_CREATE
DWORD snapdim = SNAP_IN_3D;
#else
DWORD snapdim = SNAP_IN_PLANE;
#endif
#ifdef _OSNAP
if (msg == MOUSE_FREEMOVE)
{ vpt->SnapPreview(m,m,NULL, snapdim);
}
#endif
if (msg==MOUSE_POINT||msg==MOUSE_MOVE) {
switch(point) {
case 0:
sp0 = m;
p0 = vpt->SnapPoint(m,m,NULL,snapdim);
mat.SetTrans(p0);
SWrapObj->pblock->SetValue(PB_ICONSIZE,0,0.01f);
SWrapObj->pmapParam->Invalidate();
break;
case 1: {
mat.IdentityMatrix();
sp1 = m;
p1 = vpt->SnapPoint(m,m,NULL,snapdim);
Point3 center = (p0+p1)/float(2);
mat.SetTrans(center);
SWrapObj->pblock->SetValue(PB_ICONSIZE,0,Length(p1-p0));
SWrapObj->pmapParam->Invalidate();
if (msg==MOUSE_POINT) {
if (Length(m-sp0)<3) {
return CREATE_ABORT;
} else {
ICustButton *iBut = GetICustButton(GetDlgItem(SWrapObj->hParams,IDC_AP_WRAPBUTTON));
iBut->Enable();
ReleaseICustButton(iBut);
return CREATE_STOP;
}
}
break;
}
}
} else {
if (msg == MOUSE_ABORT)
return CREATE_ABORT;
}
return TRUE;
}
示例9: proc
int GSphereObjCreateCallBack::proc(ViewExp *vpt, int msg, int point, int flags, IPoint2 m, Matrix3& mat ) {
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here
DbgAssert(!_T("Doing proc() on invalid viewport!"));
return FALSE;
}
Point3 p1, center;
if (msg == MOUSE_FREEMOVE)
{
vpt->SnapPreview(m, m, NULL, SNAP_IN_3D);
}
if (msg==MOUSE_POINT||msg==MOUSE_MOVE) {
switch(point) {
case 0: // only happens with MOUSE_POINT msg
ob->suspendSnap = TRUE;
sp0 = m;
p0 = vpt->SnapPoint(m, m, NULL, SNAP_IN_3D);
mat.SetTrans(p0);
break;
case 1:
mat.IdentityMatrix();
p1 = vpt->SnapPoint(m, m, NULL, SNAP_IN_3D);
center = (p0+p1)/float(2);
mat.SetTrans(center);
mat.SetTrans(center);
container_param_blk.InvalidateUI();
if (flags&MOUSE_CTRL) {
float ang = (float)atan2(p1.y-p0.y, p1.x-p0.x);
mat.PreRotateZ(ob->ip->SnapAngle(ang));
}
if (msg==MOUSE_POINT) {
ob->suspendSnap = FALSE;
return (Length(m-sp0)<3)?CREATE_ABORT:CREATE_STOP;
}
break;
}
} else {
if (msg == MOUSE_ABORT) return CREATE_ABORT;
}
return TRUE;
}
示例10: proc
int
FogCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags,
IPoint2 m, Matrix3& mat)
{
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here?
DbgAssert(!"Doing proc() on invalid view port!");
return FALSE;
}
Point3 p1,center;
switch ( msg ) {
case MOUSE_POINT:
case MOUSE_MOVE:
switch ( point ) {
case 0: // only happens with MOUSE_POINT msg
sp0 = m;
p0 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
mat.SetTrans(p0);
break;
case 1:
mat.IdentityMatrix();
p1 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
mat.SetTrans(p0);
float radius = Length(p1-p0);
fogObject->pblock->SetValue(PB_FOG_SIZE,
fogObject->
iObjParams->GetTime(), radius);
fogObject->pmapParam->Invalidate();
if (flags&MOUSE_CTRL) {
float ang = (float)atan2(p1.y-p0.y,p1.x-p0.x);
mat.PreRotateZ(fogObject->iObjParams->SnapAngle(ang));
}
if (msg==MOUSE_POINT) {
return (Length(m-sp0)<3)?CREATE_ABORT:CREATE_STOP;
}
break;
}
break;
case MOUSE_ABORT:
return CREATE_ABORT;
}
return TRUE;
}
示例11: switch
int
Cal3DCreateCallBack::proc(ViewExp *vpt, int msg, int point, int flags, IPoint2 m, Matrix3 &mat)
{
Point3 p1, center;
switch (msg)
{
case MOUSE_POINT:
case MOUSE_MOVE:
switch (point)
{
case 0: // only happens with MOUSE_POINT msg
sp0 = m;
p0 = vpt->SnapPoint(m, m, NULL, SNAP_IN_PLANE);
mat.SetTrans(p0);
if (msg == MOUSE_POINT)
{
return CREATE_STOP;
}
break;
}
break;
case MOUSE_ABORT:
return CREATE_ABORT;
}
return TRUE;
}
示例12: proc
int TargetObjectCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat ) {
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here
DbgAssert(!_T("Invalid viewport!"));
return FALSE;
}
Point3 c;
if (msg==MOUSE_POINT||msg==MOUSE_MOVE) {
switch(point) {
case 0:
c = vpt->GetPointOnCP(m);
mat.SetTrans(c);
return CREATE_STOP;
break;
}
}
else
if (msg == MOUSE_ABORT)
return CREATE_ABORT;
return TRUE;
}
示例13: comp_affine
// CAL-05/24/02: TODO: this should really go to core\decomp.cpp, and it should be optimized.
// For now, it's defined locally in individual files in the ctrl project.
static void comp_affine( const AffineParts &ap, Matrix3 &mat )
{
Matrix3 tm;
mat.IdentityMatrix();
mat.SetTrans( ap.t );
if ( ap.f != 1.0f ) { // has f component
tm.SetScale( Point3( ap.f, ap.f, ap.f ) );
mat = tm * mat;
}
if ( !ap.q.IsIdentity() ) { // has q rotation component
ap.q.MakeMatrix( tm );
mat = tm * mat;
}
if ( ap.k.x != 1.0f || ap.k.y != 1.0f || ap.k.z != 1.0f ) { // has k scale component
tm.SetScale( ap.k );
if ( !ap.u.IsIdentity() ) { // has u rotation component
Matrix3 utm;
ap.u.MakeMatrix( utm );
mat = Inverse( utm ) * tm * utm * mat;
} else {
mat = tm * mat;
}
}
}
示例14: proc
int BlobMeshCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat )
{
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here
DbgAssert(!_T("Invalid viewport!"));
return FALSE;
}
//TODO: Implement the mouse creation code here
if (msg==MOUSE_POINT||msg==MOUSE_MOVE) {
switch(point) {
case 0: // only happens with MOUSE_POINT msg
ob->suspendSnap = TRUE;
sp0 = m;
p0 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
mat.SetTrans(p0);
return CREATE_STOP;
break;
//TODO: Add for the rest of points
}
} else {
if (msg == MOUSE_ABORT) return CREATE_ABORT;
}
return TRUE;
}
示例15: switch
int
SwitchCreateCallBack::proc(ViewExp *vpt, int msg, int point, int flags,
IPoint2 m, Matrix3 &mat)
{
Point3 p1, center;
switch (msg)
{
case MOUSE_POINT:
case MOUSE_MOVE:
switch (point)
{
case 0: // only happens with MOUSE_POINT msg
sp0 = m;
p0 = vpt->SnapPoint(m, m, NULL, SNAP_IN_PLANE);
mat.SetTrans(p0);
break;
case 1:
mat.IdentityMatrix();
p1 = vpt->SnapPoint(m, m, NULL, SNAP_IN_PLANE);
mat.SetTrans(p0);
float radius = Length(p1 - p0);
switchSensorObject->pblock->SetValue(PB_S_SIZE,
switchSensorObject->iObjParams->GetTime(), radius);
switchSensorObject->pmapParam->Invalidate();
if (flags & MOUSE_CTRL)
{
float ang = (float)atan2(p1.y - p0.y, p1.x - p0.x);
mat.PreRotateZ(switchSensorObject->iObjParams->SnapAngle(ang));
}
if (msg == MOUSE_POINT)
{
return (Length(m - sp0) < 3) ? CREATE_ABORT : CREATE_STOP;
}
break;
}
break;
case MOUSE_ABORT:
return CREATE_ABORT;
}
return TRUE;
}