本文整理匯總了C#中System.Windows.Media.Media3D.RotateTransform3D.Freeze方法的典型用法代碼示例。如果您正苦於以下問題:C# RotateTransform3D.Freeze方法的具體用法?C# RotateTransform3D.Freeze怎麽用?C# RotateTransform3D.Freeze使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Media.Media3D.RotateTransform3D
的用法示例。
在下文中一共展示了RotateTransform3D.Freeze方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreateBin
/// <summary>
/// Create an arrow representing the magnitude and direction
/// for a given bin. This will create an arrow within a column.
/// The Column will start at 0 and go down, using the bin times a scale
/// factor to move down the column for each bin. The magnitude will
/// give the length and color of the arrow. The angle will be used to rotate around
/// the origin of 0,0, to give the direction. The angle is based off North = 0 degrees.
/// </summary>
/// <param name="bin">Bin to create.</param>
/// <param name="mag">Magnitude of the bin.</param>
/// <param name="angleYNorth">Direction of the bin with reference to Y as North.</param>
/// <returns>3D model of the arrow.</returns>
private GeometryModel3D CreateBin(int bin, double mag, double angleYNorth)
{
// Location on the axis for each bin
// Set the Camera UpDirection in XMAL to UpDirection="0, 1, 0" to make it use Y axis as Up. Default is Z up.
double xAxisLoc = 0;
double yAxisLoc = 0;
double zAxisLoc = 0;
if (YAxis)
{
yAxisLoc = -bin * TRANSLATION_SCALE;
}
else
{
xAxisLoc = bin * TRANSLATION_SCALE;
}
// Create the shape of the object
// This will be an arrow
// Use the magnitude to get the length of the arrow
// Create a column of bins with arrows
var mb = new MeshBuilder(false, false);
if (YAxis)
{
mb.AddArrow(new Point3D(xAxisLoc, yAxisLoc, zAxisLoc), new Point3D(mag * SCALE_ARROW, yAxisLoc, zAxisLoc), ARROW_HEAD_SIZE);
}
else
{
mb.AddArrow(new Point3D(xAxisLoc, yAxisLoc, zAxisLoc), new Point3D(xAxisLoc, mag * SCALE_ARROW, zAxisLoc), ARROW_HEAD_SIZE);
}
Geometry3D geometry = mb.ToMesh();
// Set the color based off the magnitude
// If the bin is selected, use the selected color
Material material;
if (bin != SelectedBin)
{
material = MaterialHelper.CreateMaterial(GenerateColor(mag));
}
else
{
material = MaterialHelper.CreateMaterial(SELECTED_BIN_COLOR);
}
material.Freeze();
// Rotate the object
var rotation = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(xAxisLoc, yAxisLoc, zAxisLoc), angleYNorth));
rotation.Freeze();
// Create the model with the rotation
var tg = new Transform3DGroup();
tg.Children.Add(rotation);
var model = new GeometryModel3D(geometry, material) { Transform = tg };
return model;
}