本文整理汇总了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 );
}