public static Matrix3d P2M(this Viewport vp) { if (vp.PerspectiveOn) { return(new Matrix3d()); } if (vp.Number == 1) { return(new Matrix3d()); } return(vp.Dcs2Wcs() * vp.Dcs2Psdcs().Inverse()); }
/// <summary> /// Checks if objects shown are inside VP extents /// </summary> /// <param name="scaleType"></param> /// <param name="acVp"></param> /// <param name="extents"></param> /// <returns></returns> private static bool IsInsideVpExtents(StandardScaleType scaleType, Viewport acVp, Extents3d extents) { acVp.StandardScale = scaleType; var vpExt = acVp.GeometricExtents; var xform = acVp.Dcs2Wcs() * acVp.Psdcs2Dcs(); var vpMin = vpExt.MinPoint.TransformBy(xform); var vpMax = vpExt.MaxPoint.TransformBy(xform); var solMin = extents.MinPoint; var solMax = extents.MaxPoint; if (vpMin.X < solMin.X && vpMin.Y < solMin.Y) { if (vpMax.X > solMax.X && vpMax.Y > solMax.Y) { return(true); } } return(false); }
/// <summary> /// Gets the transformation matrix from the World Coordinate System (WCS) /// to the specified model space viewport Display Coordinate System (DCS). /// </summary> /// <param name="vp">The instance to which this method applies.</param> /// <returns>The WCS to DCS transformation matrix.</returns> public static Matrix3d Wcs2Dcs(this Viewport vp) { return(vp.Dcs2Wcs().Inverse()); }