Author Topic: Viewport Transforms  (Read 2048 times)

0 Members and 1 Guest are viewing this topic.

kaefer

  • Guest
Viewport Transforms
« on: January 27, 2012, 11:55:25 AM »
I guess we're all familiar with gile's .NET GEOMETRY Routines, which provide transformations between User, World, Display, and Paper Space Display Coordinate Systems for the Viewport and Editor classes.

While browsing the Viewport class in arxmgd.chm (hooray for that, because Exchange sucks) I came across properties named EyeToModelTransform, ModelToEyeTransform, EyeToWorldTransform, and WorldToEyeTransform. Can anybody tell what those are supposed to do and how they correspond to the more intuitive transformations mentioned above?

LE3

  • Guest
Re: Viewport Transforms
« Reply #1 on: January 28, 2012, 11:18:51 AM »
Not familiar with Gile's stuff about this.

Have used this AcGiViewport class, in an 'Object Viewer' similar to the one that comes in the vertical MEP i.e.

For a very simple example you can use this class to view or display text to be always horizontal to any view, etc.

Reference to: arxref.chm - AcGiViewport class
« Last Edit: January 29, 2012, 11:32:39 AM by le »

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Viewport Transforms
« Reply #2 on: January 28, 2012, 11:43:43 AM »
Hi,

I had a little look at these methods.
They apply to the GraphisInterface.Viewport class (not to the DatabaseServices.Viewport class).
I do not know the difference between Model and World forms, but the World forms works like WCS2DCS ou DCS2WCS.
I used EyeToWorldTransform in CustomOsnap to display osnap glyphes parallel to the screen.

In this message, I tried to correct the transformation matrix so that the attributes text display parallel to the screen whatever the view.
I should have use EyeToWorldTransform to write:
Code - C#: [Select]
  1.             Point3d org = attRef.Position;
  2.             Matrix3d viewMat =
  3.                 Matrix3d.Displacement(vd.Viewport.CameraTarget.GetVectorTo(org)) *
  4.                 vd.Viewport.EyeToWorldTransform *
  5.                 Matrix3d.WorldToPlane(new Plane(org, attRef.Normal)) *
  6.                 Matrix3d.Rotation(-attRef.Rotation, attRef.Normal, org);
instead of:
Code - C#: [Select]
  1.             Point3d org = attRef.Position;
  2.             Vector3d zVec = vd.Viewport.ViewDirection;
  3.             Vector3d yVec = vd.Viewport.CameraUpVector;
  4.             Vector3d xVec = yVec.CrossProduct(zVec).GetNormal();
  5.             Matrix3d viewMat =
  6.                 Matrix3d.AlignCoordinateSystem(
  7.                 Point3d.Origin, Vector3d.XAxis, Vector3d.YAxis, Vector3d.ZAxis,
  8.                 org, xVec, yVec, zVec) *
  9.                 Matrix3d.WorldToPlane(new Plane(org, attRef.Normal)) *
  10.                 Matrix3d.Rotation(-attRef.Rotation, attRef.Normal, org);
Speaking English as a French Frog