本文整理汇总了C++中Matrix3::PreRotateZ方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3::PreRotateZ方法的具体用法?C++ Matrix3::PreRotateZ怎么用?C++ Matrix3::PreRotateZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3
的用法示例。
在下文中一共展示了Matrix3::PreRotateZ方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: proc
int TorusObjCreateCallBack::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;
}
float r, r2;
Point3 center;
#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: // only happens with MOUSE_POINT msg
ob->pblock->SetValue(PB_RADIUS,0,0.0f);
oldRad2 = ob->crtRadius2;
ob->suspendSnap = TRUE;
sp0 = m;
#ifdef _3D_CREATE
p0 = vpt->SnapPoint(m,m,NULL,SNAP_IN_3D);
#else
p0 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
#endif
mat.SetTrans(p0);
break;
case 1:
mat.IdentityMatrix();
//mat.PreRotateZ(HALFPI);
sp1 = m;
#ifdef _3D_CREATE
p1 = vpt->SnapPoint(m,m,NULL,SNAP_IN_3D);
#else
p1 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
#endif
if (ob->dlgCreateMeth) {
// radius
r = Length(p1-p0) - ob->crtRadius2;
mat.SetTrans(p0);
} else {
// diameter
Point3 center = (p0+p1)/float(2);
r = Length(center-p0) - ob->crtRadius2;
mat.SetTrans(center); // Modify Node's transform
}
if (msg==MOUSE_POINT) {
ob->suspendSnap = FALSE;
if (Length(m-sp0)<3 || Length(p1-p0)<0.1f)
return CREATE_ABORT;
}
ob->pblock->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));
}
break;
case 2:
center = mat.GetTrans();
mat.IdentityMatrix();
//mat.PreRotateZ(HALFPI);
mat.SetTrans(center);
#ifdef _3D_CREATE
p2 = vpt->SnapPoint(m,m,NULL,SNAP_IN_3D);
#else
p2 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
#endif
r = Length(p1-p0);
r2 = Length(p2-p0);
//O.Z. *** begin fix for bug #189695
if (ob->dlgCreateMeth) {
ob->crtRadius2 = (float)fabs(r-r2)/2.0f;
ob->pblock->SetValue(PB_RADIUS,0,(r2+r)/2.0f);
ob->pblock->SetValue(PB_RADIUS2,0,ob->crtRadius2);
ob->pmapParam->Invalidate();
}else{
Point3 center = (p2+p0)/float(2);
r = Length(center-p0);
mat.SetTrans(center); // Modify Node's transform
ob->pblock->SetValue(PB_RADIUS,0,r);
}
//O.Z. *** end fix for bug #189695
//.........这里部分代码省略.........
示例6: proc
int ParticleMesherObjCreateCallBack::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;
}
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
mat.IdentityMatrix();
ob->suspendSnap = TRUE;
sp0 = m;
p0 = vpt->SnapPoint(m, m, NULL, SNAP_IN_3D);
mat.SetTrans(p0);
ob->radius = 3.0f;
ob->pblock2->SetValue(particlemesher_radius, 0, ob->radius);
break;
case 1:
p1 = vpt->SnapPoint(m, m, NULL, SNAP_IN_3D);
// center = (p0+p1)/float(2);
// mat.SetTrans(center);
r = Length(p0-p1);
// mat.SetTrans(center);
// ob->pblock2->SetValue(geo_radius, 0, r);
ob->pblock2->SetValue(particlemesher_rendertimeonly, 0, 0);
ob->pblock2->SetValue(particlemesher_radius, 0, r);
ob->radius = r;
//DebugPrint(_T("radius %f\n"),r);
particlemesher_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;
}
示例7: proc
int CapsuleObjCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat )
{
float r;
Point3 center;
if (ob == NULL)
{
return CREATE_ABORT;
}
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_RADIUS1,0,0.0f);
ob->pblock2->SetValue(PB_RADIUS2,0,0.0f);
ob->suspendSnap = TRUE;
sp[0] = m;
p[0] = vpt->SnapPoint(m,m,NULL,SNAP_IN_3D);
ob->pblock2->SetValue(PB_LENGTH,0,0.0f);
mat.SetTrans(p[0]);
break;
case 1: // Fix radius of first cap
mat.IdentityMatrix();
//mat.PreRotateZ(HALFPI);
sp[1] = m;
p[1] = vpt->SnapPoint(m,m,NULL,SNAP_IN_3D);
r = Length(p[1]-p[0]);
mat.SetTrans(p[0]);
ob->pblock2->SetValue(PB_RADIUS1,0,r);
ob->pblock2->SetValue(PB_RADIUS2,0,r);
ob->pmapParam->Invalidate();
if (flags&MOUSE_CTRL)
{
float ang = (float)atan2(p[1].y-p[0].y,p[1].x-p[0].x);
mat.PreRotateZ(ob->ip->SnapAngle(ang));
}
if (msg==MOUSE_POINT)
{
if (Length(m-sp[0])<3 || Length(p[1]-p[0])<0.1f) {
ob->suspendSnap = FALSE;
return CREATE_ABORT;
}
}
break;
case 2: // Get second point
mat.IdentityMatrix();
//mat.PreRotateZ(HALFPI);
sp[2] = m;
p[2] = vpt->SnapPoint(m,m,NULL,SNAP_IN_3D);
r = Length(p[2]-p[1]);
mat.SetTrans(p[0]);
ob->pblock2->SetValue(PB_LENGTH,0,r);
ob->pmapParam->Invalidate();
// Stop unless Ctrl is selected then we size the final radius
if (msg==MOUSE_POINT && !(flags&MOUSE_CTRL) )
{
ob->suspendSnap = FALSE;
return CREATE_STOP;
}
break;
case 3: // Size the second cap
mat.IdentityMatrix();
//mat.PreRotateZ(HALFPI);
sp[3] = m;
p[3] = vpt->SnapPoint(m,m,NULL,SNAP_IN_3D);
if (flags&MOUSE_CTRL) // ignore radius
{
r = Length(p[1]-p[0]);
ob->pblock2->SetValue(PB_RADIUS2,0,r);
}
else
{
// start radius at r1
r = Length((p[3]-p[2]) + (p[1]-p[0]));
ob->pblock2->SetValue(PB_RADIUS2,0,r);
}
ob->pmapParam->Invalidate();
if (msg==MOUSE_POINT)
{
ob->suspendSnap = FALSE;
//.........这里部分代码省略.........
示例8: proc
int ChCylinderObjCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat ) {
float f;
#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:
ob->suspendSnap = TRUE;
sp0 = m;
p[0] = vpt->SnapPoint(m,m,NULL,snapdim);
mat.SetTrans(p[0]); // Set Node's transform
ob->pblock->SetValue(PB_RADIUS,0,0.01f);
ob->pblock->SetValue(PB_HEIGHT,0,0.01f);
ob->pblock->SetValue(PB_FILLET,0,0.01f);
ob->increate=TRUE;
break;
case 1:
mat.IdentityMatrix();
//mat.PreRotateZ(HALFPI);
sp1 = m;
p[1] = vpt->SnapPoint(m,m,NULL,snapdim);
if (ob->dlgCreateMeth) {
// radius
r = Length(p[1]-p[0]);
mat.SetTrans(p[0]);
} else {
// diameter
Point3 center = (p[0]+p[1])/float(2);
r = Length(center-p[0]);
mat.SetTrans(center); // Modify Node's transform
}
ob->pblock->SetValue(PB_RADIUS,0,r);
ob->pmapParam->Invalidate();
if (flags&MOUSE_CTRL) {
float ang = (float)atan2(p[1].y-p[0].y,p[1].x-p[0].x);
mat.PreRotateZ(ob->ip->SnapAngle(ang));
}
if (msg==MOUSE_POINT) {
if (Length(m-sp0)<3 ||
Length(p[1]-p[0])<0.1f) {
ob->increate=FALSE;
return CREATE_ABORT;
}
}
break;
case 2:
{ sp2=m;
#ifdef _OSNAP
h = vpt->SnapLength(vpt->GetCPDisp(p[1],Point3(0,0,1),sp1,m,TRUE));
#else
h = vpt->SnapLength(vpt->GetCPDisp(p[1],Point3(0,0,1),sp1,m));
#endif
ob->pblock->SetValue(PB_HEIGHT,0,h);
ob->pmapParam->Invalidate();
if (msg==MOUSE_POINT) {
if (Length(m-sp0)<3)
{ ob->increate=FALSE;return CREATE_ABORT;}
}
}
break;
case 3:
f =vpt->SnapLength(vpt->GetCPDisp(p[1],Point3(0,1,0),sp2,m));
float hh=0.5f*float(fabs(h));if (f<0.0f) f=0.0f;
if (f>r) f=r;
if (f>hh) f=hh;
ob->pblock->SetValue(PB_FILLET,0,f);
ob->pmapParam->Invalidate();
if (msg==MOUSE_POINT)
{ ob->suspendSnap = FALSE;
ob->increate=FALSE;
return CREATE_STOP;
}
break;
}
}
else
if (msg == MOUSE_ABORT) {
ob->increate=FALSE;
return CREATE_ABORT;
}
return TRUE;
}
示例9: proc
int ScubaObjCreateCallBack::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 _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:
ob->suspendSnap = TRUE;
sp0 = m;
p[0] = vpt->SnapPoint(m,m,NULL,snapdim);
mat.SetTrans(p[0]); // Set Node's transform
ob->pblock->SetValue(PB_RADIUS,0,0.01f);
ob->pblock->SetValue(PB_HEIGHT,0,0.01f);
ob->increate=TRUE;
break;
case 1:
mat.IdentityMatrix();
//mat.PreRotateZ(HALFPI);
sp1 = m;
p[1] = vpt->SnapPoint(m,m,NULL,snapdim);
if (ob->dlgCreateMeth) {
// radius
r = Length(p[1]-p[0]);
mat.SetTrans(p[0]);
} else {
// diameter
Point3 center = (p[0]+p[1])/float(2);
r = Length(center-p[0]);
mat.SetTrans(center); // Modify Node's transform
}
ob->pblock->SetValue(PB_RADIUS,0,r);
ob->pblock->SetValue(PB_HEIGHT,0,2.0f*r);
ob->pmapParam->Invalidate();
if (flags&MOUSE_CTRL) {
float ang = (float)atan2(p[1].y-p[0].y,p[1].x-p[0].x);
mat.PreRotateZ(ob->ip->SnapAngle(ang));
}
if (msg==MOUSE_POINT) {
if (Length(m-sp0)<3 ||
Length(p[1]-p[0])<0.1f) {
ob->increate=FALSE;
return CREATE_ABORT;
} h=2.0f*r;
}
break;
case 2:
{
#ifdef _OSNAP
float h1 = vpt->SnapLength(vpt->GetCPDisp(p[1],Point3(0,0,1),sp1,m,TRUE));
#else
float h1 = vpt->SnapLength(vpt->GetCPDisp(p[1],Point3(0,0,1),sp1,m));
#endif
float hmin=2.0f*r;
h1+=(h1<0.0f?-hmin:hmin);
ob->pblock->SetValue(PB_HEIGHT,0,h1);
ob->pmapParam->Invalidate();
if (msg==MOUSE_POINT) {
ob->suspendSnap = FALSE;
ob->increate=FALSE;
return (Length(m-sp0)<3)?CREATE_ABORT:CREATE_STOP;
}
}
break;
}
}
else
if (msg == MOUSE_ABORT) {
ob->increate=FALSE;
return CREATE_ABORT;
}
return TRUE;
}