/// <summary> /// Transform a point /// </summary> /// <param name="inPoint">input point</param> /// <param name="result">output point</param> /// <returns>True if the point is transformed successfully</returns> public override bool TryTransform(Point3D inPoint, out Point3D result) { result = inPoint; // cache the children to avoid a repeated DP access GeneralTransform3DCollection children = Children; if ((children == null) || (children.Count == 0)) { return(false); } bool pointTransformed = true; // transform the point through each of the transforms for (int i = 0, count = children.Count; i < count; i++) { if (children._collection[i].TryTransform(inPoint, out result) == false) { pointTransformed = false; break; } inPoint = result; } return(pointTransformed); }
internal Enumerator(GeneralTransform3DCollection list) { Debug.Assert(list != null, "list may not be null."); _list = list; _version = list._version; _index = -1; _current = default(GeneralTransform3D); }
/// <summary> /// Implementation of Freezable.GetCurrentValueAsFrozenCore() /// </summary> protected override void GetCurrentValueAsFrozenCore(Freezable source) { GeneralTransform3DCollection sourceGeneralTransform3DCollection = (GeneralTransform3DCollection)source; base.GetCurrentValueAsFrozenCore(source); int count = sourceGeneralTransform3DCollection._collection.Count; _collection = new FrugalStructList <GeneralTransform3D>(count); for (int i = 0; i < count; i++) { GeneralTransform3D newValue = (GeneralTransform3D)sourceGeneralTransform3DCollection._collection[i].GetCurrentValueAsFrozen(); OnFreezablePropertyChanged(/* oldValue = */ null, newValue); _collection.Add(newValue); } }
/// <summary> /// Transforms the bounding box to the smallest axis aligned bounding box /// that contains all the points in the original bounding box /// </summary> /// <param name="rect">Input bounding rect</param> /// <returns>Transformed bounding rect</returns> public override Rect3D TransformBounds(Rect3D rect) { // cache the children to avoid a repeated DP access GeneralTransform3DCollection children = Children; if ((children == null) || (children.Count == 0)) { return(rect); } Rect3D result = rect; for (int i = 0, count = children.Count; i < count; i++) { result = children._collection[i].TransformBounds(result); } return(result); }