private bool TestGeometryAgainstFrustum(MeshGeometry3D rawGeometry, Material frontMaterial, Material backMaterial, BoundingVolume frustum, Matrix3D transform) { if (rawGeometry == null) { return(false); } TriangleEnumerator triangleEnumerator = new TriangleEnumerator(rawGeometry.Positions, rawGeometry.TriangleIndices); Point3D[] point3DArray = new Point3D[3]; foreach (int[] numArray in triangleEnumerator.TriangleList) { point3DArray[0] = rawGeometry.Positions[numArray[0]]; point3DArray[1] = rawGeometry.Positions[numArray[1]]; point3DArray[2] = rawGeometry.Positions[numArray[2]]; transform.Transform(point3DArray); if (frustum.IsPolygonContainedOrIntersecting(point3DArray)) { double num = Vector3D.DotProduct(Vector3D.CrossProduct(point3DArray[1] - point3DArray[0], point3DArray[2] - point3DArray[0]), point3DArray[0] - this.frustumCenterRay.Origin); if (Tolerances.LessThanOrClose(num, 0.0) && frontMaterial != null || Tolerances.GreaterThan(num, 0.0) && backMaterial != null) { return(true); } } } return(false); }
protected virtual void ComputeIdealAlignment() { this.Settings.HorizontalAlignment = (this.WidthConstraintMode & LayoutConstraintMode.CanvasLike) == LayoutConstraintMode.NonOverlappingGridlike ? (!Tolerances.LessThanOrClose(this.ChildRect.Right, (this.SlotRect.Left + this.SlotRect.Right) / 2.0) ? (!Tolerances.GreaterThanOrClose(this.ChildRect.Left, (this.SlotRect.Left + this.SlotRect.Right) / 2.0) ? HorizontalAlignment.Stretch : HorizontalAlignment.Right) : HorizontalAlignment.Left) : HorizontalAlignment.Stretch; if ((this.HeightConstraintMode & LayoutConstraintMode.CanvasLike) != LayoutConstraintMode.NonOverlappingGridlike) { this.Settings.VerticalAlignment = VerticalAlignment.Stretch; } else if (Tolerances.LessThanOrClose(this.ChildRect.Bottom, (this.SlotRect.Top + this.SlotRect.Bottom) / 2.0)) { this.Settings.VerticalAlignment = VerticalAlignment.Top; } else if (Tolerances.GreaterThanOrClose(this.ChildRect.Top, (this.SlotRect.Top + this.SlotRect.Bottom) / 2.0)) { this.Settings.VerticalAlignment = VerticalAlignment.Bottom; } else { this.Settings.VerticalAlignment = VerticalAlignment.Stretch; } }