예제 #1
0
        public Transform3D CalculateSpotLightTransformation()
        {
            SpotLight        spotLight        = (SpotLight)this.Element.ViewObject.PlatformSpecificObject;
            Transform3DGroup transform3Dgroup = new Transform3DGroup();
            double           num = SpotLightAdorner3D.CalculateConeRadius(spotLight, this.typeOfConeAngle);

            transform3Dgroup.Children.Add((Transform3D) new ScaleTransform3D(num, num, 1.0));
            transform3Dgroup.Children.Add((Transform3D) new TranslateTransform3D(new Vector3D(0.0, 0.0, 1.0)));
            transform3Dgroup.Children.Add((Transform3D) new RotateTransform3D(Vector3DEditor.GetRotation3DFromDirection(spotLight.Direction)));
            transform3Dgroup.Children.Add((Transform3D) new TranslateTransform3D((Vector3D)spotLight.Position));
            return((Transform3D)transform3Dgroup);
        }
예제 #2
0
        public override void PositionAndOrientGeometry()
        {
            SpotLight spotLight      = (SpotLight)this.Element.ViewObject.PlatformSpecificObject;
            double    angleInDegrees = this.typeOfConeAngle != SpotLightAdornerBehavior3D.TypeOfConeAngle.InnerConeAngle ? spotLight.OuterConeAngle : spotLight.InnerConeAngle;
            double    num            = SpotLightAdorner3D.CalculateConeRadius(spotLight, this.typeOfConeAngle);
            double    y = Math.Sqrt(num * num + 1.0);

            for (int index = 0; index < 4; ++index)
            {
                Transform3DGroup transform3Dgroup = new Transform3DGroup();
                transform3Dgroup.Children.Add((Transform3D) new ScaleTransform3D(new Vector3D(1.0, y, 1.0)));
                Quaternion quaternion = Quaternion.Identity * new Quaternion(new Vector3D(0.0, 0.0, 1.0), (double)(90 * index)) * new Quaternion(new Vector3D(1.0, 0.0, 0.0), angleInDegrees) * new Quaternion(new Vector3D(1.0, 0.0, 0.0), 90.0);
                transform3Dgroup.Children.Add((Transform3D) new RotateTransform3D((Rotation3D) new QuaternionRotation3D(quaternion)));
                transform3Dgroup.Children.Add((Transform3D) new RotateTransform3D(Vector3DEditor.GetRotation3DFromDirection(spotLight.Direction)));
                transform3Dgroup.Children.Add((Transform3D) new TranslateTransform3D((Vector3D)spotLight.Position));
                this.spotPropertyGeometry.Children[index].Transform = (Transform3D)transform3Dgroup;
            }
        }