当前位置: 首页>>代码示例>>C#>>正文


C# Matrix3x3.MakeRot方法代码示例

本文整理汇总了C#中Matrix3x3.MakeRot方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix3x3.MakeRot方法的具体用法?C# Matrix3x3.MakeRot怎么用?C# Matrix3x3.MakeRot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Matrix3x3的用法示例。


在下文中一共展示了Matrix3x3.MakeRot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FittingForm

        public FittingForm()
        {
            // 			Random		RNG = new Random();
            // 			Vector		From = new Vector( 2.0f * (float) RNG.NextDouble() - 1.0f, 2.0f * (float) RNG.NextDouble() - 1.0f, 2.0f * (float) RNG.NextDouble() - 1.0f ).Normalized;
            // 			Vector		To = new Vector( 2.0f * (float) RNG.NextDouble() - 1.0f, 2.0f * (float) RNG.NextDouble() - 1.0f, 2.0f * (float) RNG.NextDouble() - 1.0f ).Normalized;
            // 			Matrix3x3	Pipo = MakeRot( From, To );
            // 			Vector		Test = Pipo * From;

            //TestChromaRanges();
            //TestSHRGBEEncoding();
            TestSquareFilling();

            InitializeComponent();

            // Create the random points
            List< Vector >	RandomDirections = new List< Vector >();
            List< float >	RandomThetas = new List< float >();
            for ( int LobeIndex=0; LobeIndex < m_RandomLobes.Length; LobeIndex++ )
            {
                float	MainPhi = (float) (m_RandomLobes[LobeIndex].Phi * Math.PI / 180.0f);
                float	MainTheta = (float) (m_RandomLobes[LobeIndex].Theta * Math.PI / 180.0f);
                float	Concentration = m_RandomLobes[LobeIndex].Concentration;
                int		PointsCount = m_RandomLobes[LobeIndex].RandomPointsCount;

                // Build the main direction for the target lobe
                Vector		MainDirection = new Vector(
                    (float) (Math.Sin( MainTheta ) * Math.Sin( MainPhi )),
                    (float) (Math.Cos( MainTheta )),
                    (float) (Math.Sin( MainTheta ) * Math.Cos( MainPhi ))
                    );

                // Build the transform to bring Y-aligned points to the main direction
                Matrix3x3	Rot = new Matrix3x3();
                Rot.MakeRot( Vector.UnitY, MainDirection );

                BuildDistributionMapping( Concentration, 0.0 );

                // Draw random points in the Y-aligned hemisphere and transform them into the main direction
                for ( int PointIndex=0; PointIndex < PointsCount; PointIndex++ )
                {
                    double	Theta = GetTheta();
                    float	CosTheta = (float) Math.Cos( Theta );
            //					float	SinTheta = (float) Math.Sqrt( 1.0f - CosTheta*CosTheta );
                    float	SinTheta = (float) Math.Sin( Theta );
                    float	Phi = (float) (WMath.SimpleRNG.GetUniform() * Math.PI);

                    Vector	RandomDirection = new Vector(
                        (float) (SinTheta * Math.Sin( Phi )),
                        CosTheta,
                        (float) (SinTheta * Math.Cos( Phi ))
                        );

                    Vector	FinalDirection = RandomDirection * Rot;

                    RandomDirections.Add( FinalDirection );

                    RandomThetas.Add( CosTheta );
                }
            }

            m_RandomDirections = RandomDirections.ToArray();
            m_RandomThetas = RandomThetas.ToArray();

            panelOutput.UpdateBitmap();
            panelOutputNormalDistribution.UpdateBitmap();

            // Do it!
            FitLobe[]	Result = new FitLobe[FITTING_LOBES_COUNT];
            for ( int h=0; h < Result.Length; h++ )
                Result[h] = new FitLobe();
            PerformExpectationMaximization( m_RandomDirections, Result );
        }
开发者ID:Patapom,项目名称:GodComplex,代码行数:72,代码来源:Form1.cs


注:本文中的Matrix3x3.MakeRot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。