public void RotateDataToLine(IVector3 pt1, IVector3 pt2) { try { var _dataRotationRad = GetDataRotation(pt1, pt2); var origin = new Vector3(0, 0, 0); var rotStart = pt1.RotateZ(origin, -1 * _dataRotationRad); var rotEnd = pt2.RotateZ(origin, -1 * _dataRotationRad); var vTrans = new Vector3(0, -1 * rotEnd.Y, 0); var rotData = new CartData(); foreach (IVector3 pt in data) { var ptRot = pt.RotateZ(origin, -1 * _dataRotationRad); var ptTrans = ptRot.Translate(vTrans); rotData.Add(ptTrans); } data.Clear(); data.AddRange(rotData); } catch (Exception) { throw; } }