private Plane Offset(Vector offset) { IPointEntity origin = Origin.PointEntity; IPointEntity newOrigin = origin.Add(offset); Plane plane = Plane.ByOriginNormal(newOrigin.ToPoint(false, null), Normal, Size); plane.Context = this; return(plane); }
private Polygon CreatePlaneVisuals(double size, bool persist) { // to display a plane we would be required to draw a rectangle in the plane // // /* * given origin, X & Y * we want to evaluate the four corner points based on size * * where o is the origin of the plane * * Y | | | v1 ______________ v2 | | | | | | | | o | | | | | v4 |______________| v3 | | X |_________________________________________ * */ ICoordinateSystemEntity coordSys = PlaneEntity.GetCoordinateSystem(); IPointEntity orig = coordSys.Origin; var xNorm = new Vector(coordSys.XAxis).Normalize().MultiplyBy(size / 2.0); var yNorm = new Vector(coordSys.YAxis).Normalize().MultiplyBy(size / 2.0); var dirv1 = yNorm - xNorm; var dirv2 = yNorm + xNorm; var dirv3 = dirv1.Negate(); var dirv4 = dirv2.Negate(); Point[] positions = { orig.Add(dirv1).ToPoint(false, null), orig.Add(dirv2).ToPoint(false, null), orig.Add(dirv3).ToPoint(false, null), orig.Add(dirv4).ToPoint(false, null) }; return(new Polygon(positions, persist)); }
/// <summary> /// /// </summary> /// <param name="u"></param> /// <param name="v"></param> /// <param name="offset"></param> /// <returns></returns> internal DSPoint PointAtParametersCore(ref double u, ref double v, double offset) { bool uchange = DSGeometryExtension.ClipParamRange(ref u); bool vchange = DSGeometryExtension.ClipParamRange(ref v); // TO DO - throw a warning each time a condition above is satisfied. //throw new System.ArgumentException(string.Format(Properties.Resources.InvalidInput, "u or v parameter", "Surface.PointAtParameters")); IPointEntity pt = SurfaceEntity.PointAtParameter(u, v); if (!offset.EqualsTo(0.0)) { DSVector normal = new DSVector(SurfaceEntity.NormalAtPoint(pt)); DSVector translation = normal.Normalize().Scale(offset); IPointEntity offsetPt = pt.Add(translation); pt.Dispose(); pt = offsetPt; } return(pt.ToPoint(true, this)); }