public static SingleFamily Move(SingleFamily house, Vector3d vector) { SingleFamily movedHouse = house.Clone(); Transform t = Transform.Translation(vector); movedHouse.GardenBound.Transform(t); movedHouse.HouseGeom.Transform(t); movedHouse.AccessPoint += new Point3d(vector); movedHouse.MidPoint += new Point3d(vector); return(movedHouse); }
//====================================================================// public static ObjectModel.SingleFamily Translate(SingleFamily house, Point3d boundPt, Vector3d tan) { Point3d basePt = house.AccessPoint; Line accessLine = Query.ClosestSegmentToPoint(basePt, house.GardenBound); Vector3d accessVec = Compute.CreateVector(accessLine.To, accessLine.From); SingleFamily movedHouse = house.Clone(); Transform t = Transform.Translation(Compute.CreateVector(basePt, boundPt)); Transform r = Transform.Rotation(accessVec, tan, boundPt); movedHouse.GardenBound.Transform(t); movedHouse.GardenBound.Transform(r); movedHouse.HouseGeom.Transform(t); movedHouse.HouseGeom.Transform(r); movedHouse.Orientation = Compute.CrossProduct(Vector3d.ZAxis, tan); movedHouse.MidPoint = movedHouse.GardenBound.CenterPoint(); // add a real translation here maybe? movedHouse.AccessPoint = boundPt; return(movedHouse); }