本文整理汇总了C#中System.Windows.Media.Media3D.Transform3D类的典型用法代码示例。如果您正苦于以下问题:C# Transform3D类的具体用法?C# Transform3D怎么用?C# Transform3D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Transform3D类属于System.Windows.Media.Media3D命名空间,在下文中一共展示了Transform3D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PushModelTransform
internal void PushModelTransform(Transform3D transform)
{
if (transform != null && transform != Transform3D.Identity)
{
_modelTransformStack.Push(transform.Value);
}
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:7,代码来源:HitTestParameters3D.cs
示例2: Expand
private void Expand(GeometryModel3D model, Transform3D transformation)
{
Transform3D ot;
if (originalTransforms.ContainsKey(model))
ot = originalTransforms[model];
else
{
ot = model.Transform;
originalTransforms.Add(model, ot);
}
Transform3D totalTransform = Transform3DHelper.CombineTransform(transformation, ot);
var mesh = model.Geometry as MeshGeometry3D;
if (mesh == null)
return;
var bounds = new Rect3D();
foreach (int i in mesh.TriangleIndices)
bounds.Union(totalTransform.Transform(mesh.Positions[i]));
Point3D p = bounds.Location;
Vector3D d = p - actualExpandOrigin;
d *= Expansion;
Point3D p2 = actualExpandOrigin + d;
var t = new TranslateTransform3D(p2 - p);
model.Transform = Transform3DHelper.CombineTransform(ot, t);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:28,代码来源:Expander3D.cs
示例3: Transform3DVector
public static Vector3D Transform3DVector(Transform3D transform, Vector3D vector)
{
Point3D input = new Point3D(vector.X, vector.Y, vector.Z);
Point3D output;
return transform != null && transform.TryTransform(input, out output) ? new Vector3D(output.X, output.Y, output.Z) : vector;
}
开发者ID:loic-lavergne,项目名称:mckineap,代码行数:7,代码来源:SimpleHelperClasses.cs
示例4: Rotate3D
public static MatrixTransform3D Rotate3D(Transform3D transform, double x, double y, double z, Point3D center, Vector3D up, Vector3D look, RotationType type)
{
if (type != RotationType.LockAxisY)
{
up = transform.Transform(up);
}
if (type != RotationType.LockAxisZ)
{
look = transform.Transform(look);
}
center = transform.Transform(center);
Vector3D axisX = Vector3D.CrossProduct(up, look);
Matrix3D matrix = new Matrix3D();
matrix.RotateAt(new Quaternion(axisX, x), center);
matrix.RotateAt(new Quaternion(up, y), center);
matrix.RotateAt(new Quaternion(look, z), center);
MatrixTransform3D mOriginTransform = transform as MatrixTransform3D;
//mOriginTransform.Matrix.RotateAt(
try
{
return new MatrixTransform3D(Matrix3D.Multiply(mOriginTransform.Matrix, matrix));
}
catch (Exception err)
{
Exceptions.LogOnly(err);
return null;
}
}
开发者ID:mind0n,项目名称:hive,代码行数:28,代码来源:MatrixHelper.cs
示例5: applyTransform
//Given a 3d object, it will apply the transform to it and return the new object. Note that it will not
//overwrite the objects current transformation:
public static Model3DGroup applyTransform(Model3DGroup obj, Transform3D transform)
{
Model3DGroup newObj = new Model3DGroup();
newObj.Children.Add(obj);
newObj.Transform = transform;
return newObj;
}
开发者ID:CRogers,项目名称:KinectGroupPractical,代码行数:9,代码来源:Transforms.cs
示例6: CalcRotationMatrix
public static Matrix3D CalcRotationMatrix(double x, double y, double z, Point3D center, Vector3D up, Vector3D look, Transform3D transform, RotationType type)
{
//Transform3DGroup trm = new Transform3DGroup();
//trm.Children.Add(transform);
Vector3D realup = transform.Transform(up);
if (type != RotationType.LockAxisY)
{
up = realup;
}
if (type != RotationType.LockAxisZ)
{
look = transform.Transform(look);
}
center = transform.Transform(center);
Vector3D axisX = Vector3D.CrossProduct(up, look);
Matrix3D matrix = new Matrix3D();
//Quaternion q = new Quaternion();
//q.
double ang = AngleBetween(realup, YAxis) + x;
if (ang >= 90)
{
x = 90 - ang;
}
matrix.RotateAt(new Quaternion(axisX, x), center);
matrix.RotateAt(new Quaternion(up, y), center);
matrix.RotateAt(new Quaternion(look, z), center);
return matrix;
}
开发者ID:mind0n,项目名称:hive,代码行数:28,代码来源:MatrixHelper.cs
示例7: PrependInverseTransform
internal static void PrependInverseTransform(Transform3D transform, ref Matrix3D viewMatrix)
{
if (transform != null && transform != Transform3D.Identity)
{
PrependInverseTransform(transform.Value, ref viewMatrix);
}
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:7,代码来源:Camera.cs
示例8: CombineTransform
/// <summary>
/// Combines two transforms.
/// </summary>
/// <param name="t1">
/// The first transform.
/// </param>
/// <param name="t2">
/// The second transform.
/// </param>
/// <returns>
/// The combined transform group.
/// </returns>
public static Transform3D CombineTransform(Transform3D t1, Transform3D t2)
{
var g = new Transform3DGroup();
g.Children.Add(t1);
g.Children.Add(t2);
return g;
}
开发者ID:sivarajankumar,项目名称:dentalsmile,代码行数:19,代码来源:Transform3DHelper.cs
示例9: ExportLight
/// <summary>
/// Exports the light.
/// </summary>
/// <param name="light">
/// The light.
/// </param>
/// <param name="inheritedTransform">
/// The inherited transform.
/// </param>
protected override void ExportLight(Light light, Transform3D inheritedTransform)
{
base.ExportLight(light, inheritedTransform);
// todo...
// http://www.povray.org/documentation/view/3.6.1/34/
}
开发者ID:BEEden,项目名称:Diplomarbeit,代码行数:16,代码来源:PovRayExporter.cs
示例10: Plant
public Plant()
{
var x = new Vector3D(1, 0, 0);
var r1 = new RotateTransform3D(new AxisAngleRotation3D(x, 80));
var r2 = new RotateTransform3D(new AxisAngleRotation3D(x, -70));
var r3 = new RotateTransform3D(new AxisAngleRotation3D(x, -10));
var t1 = new TranslateTransform3D(0, 0, 0.5);
var t2 = new TranslateTransform3D(0, 0, 0.7);
var t3 = new TranslateTransform3D(0, 0, 1.0);
var s1 = new ScaleTransform3D(0.5, 0.5, 0.5);
var s2 = new ScaleTransform3D(0.3, 0.3, 0.3);
var s3 = new ScaleTransform3D(0.8, 0.8, 0.8);
var m1 = new Transform3DGroup();
m1.Children.Add(r1);
m1.Children.Add(s1);
m1.Children.Add(t1);
var m2 = new Transform3DGroup();
m2.Children.Add(r2);
m2.Children.Add(s2);
m2.Children.Add(t2);
var m3 = new Transform3DGroup();
m3.Children.Add(r3);
m3.Children.Add(s3);
m3.Children.Add(t3);
T1 = m1;
T2 = m2;
T3 = m3;
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:28,代码来源:Plant.cs
示例11: CreateViewMatrix
// Transfrom that moves the world to a camera coordinate system
// where the camera is at the origin looking down the negative z
// axis and y is up.
//
// NOTE: We consider camera.Transform to be part of the view matrix.
//
internal static Matrix3D CreateViewMatrix(Transform3D transform, ref Point3D position, ref Vector3D lookDirection, ref Vector3D upDirection)
{
Vector3D zaxis = -lookDirection;
zaxis.Normalize();
Vector3D xaxis = Vector3D.CrossProduct(upDirection, zaxis);
xaxis.Normalize();
Vector3D yaxis = Vector3D.CrossProduct(zaxis, xaxis);
Vector3D positionVec = (Vector3D) position;
double cx = -Vector3D.DotProduct(xaxis, positionVec);
double cy = -Vector3D.DotProduct(yaxis, positionVec);
double cz = -Vector3D.DotProduct(zaxis, positionVec);
Matrix3D viewMatrix = new Matrix3D(
xaxis.X, yaxis.X, zaxis.X, 0,
xaxis.Y, yaxis.Y, zaxis.Y, 0,
xaxis.Z, yaxis.Z, zaxis.Z, 0,
cx, cy, cz, 1);
PrependInverseTransform(transform, ref viewMatrix);
return viewMatrix;
}
开发者ID:JianwenSun,项目名称:cc,代码行数:31,代码来源:ProjectionCamera.cs
示例12: AlphaSort
// http://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Components-PostAttachments/00-04-01-86-12/SceneSortingHelper_2E00_cs
/// <summary>
/// Sort Modelgroups in Farthest to Closest order, to enable transparency
/// Should be applied whenever the scene is significantly re-oriented
/// </summary>
public static void AlphaSort(Point3D cameraPosition, Model3DCollection models, Transform3D worldTransform)
{
var sortedList = models.OrderBy(model => Point3D.Subtract(cameraPosition, worldTransform.Transform(model.Bounds.Location)).Length);
models.Clear();
foreach (var model in sortedList)
{
models.Add(model);
}
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:15,代码来源:OpacitySortingHelper.cs
示例13: ExportModel
/// <summary>
/// Exports the model.
/// </summary>
/// <param name="model">
/// The model.
/// </param>
/// <param name="inheritedTransform">
/// The inherited transform.
/// </param>
protected override void ExportModel(GeometryModel3D model, Transform3D inheritedTransform)
{
var mesh = model.Geometry as MeshGeometry3D;
if (mesh == null)
{
return;
}
// todo
}
开发者ID:sivarajankumar,项目名称:dentalsmile,代码行数:19,代码来源:RenderManExporter.cs
示例14: ExportModel
protected override void ExportModel(GeometryModel3D model, Transform3D transform)
{
writer.WriteLine(String.Format("o object{0}", objectNo++));
writer.WriteLine(String.Format("g group{0}", groupNo++));
string matName = String.Format("mat{0}", matNo++);
writer.WriteLine(String.Format("usemtl {0}", matName));
ExportMaterial(matName, model.Material, model.BackMaterial);
var mesh = model.Geometry as MeshGeometry3D;
ExportMesh(mesh, Transform3DHelper.CombineTransform(transform, model.Transform));
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:10,代码来源:ObjExporter.cs
示例15: PushVisualTransform
//------------------------------------------------------
//
// Public Methods
//
//-----------------------------------------------------
//------------------------------------------------------
//
// Public Properties
//
//------------------------------------------------------
//-----------------------------------------------------
//
// Public Events
//
//------------------------------------------------------
//-----------------------------------------------------
//
// Internal Methods
//
//-----------------------------------------------------
internal void PushVisualTransform(Transform3D transform)
{
Debug.Assert(!HasModelTransformMatrix,
"ModelTransform stack should be empty when pusing a visual transform");
if (transform != null && transform != Transform3D.Identity)
{
_visualTransformStack.Push(transform.Value);
}
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:35,代码来源:HitTestParameters3D.cs
示例16: AddContours
private void AddContours(GeometryModel3D model, Transform3D transform)
{
var p = ContourPlane.Position;
var n = ContourPlane.Normal;
var segments = MeshGeometryHelper.GetContourSegments(model.Geometry as MeshGeometry3D, p, n).ToList();
foreach (var contour in MeshGeometryHelper.CombineSegments(segments, 1e-6).ToList())
{
if (contour.Count == 0)
continue;
view2.Children.Add(new TubeVisual3D { Diameter = 0.03, Path = new Point3DCollection(contour), Fill = Brushes.Green });
}
}
开发者ID:BEEden,项目名称:Diplomarbeit,代码行数:12,代码来源:MainWindow.xaml.cs
示例17: GetTransformedPerspectiveCamera
public static PerspectiveCamera GetTransformedPerspectiveCamera(PerspectiveCamera camera, Transform3D transform)
{
return new PerspectiveCamera
{
LookDirection = transform.Transform(camera.LookDirection),
UpDirection = transform.Transform(camera.UpDirection),
FieldOfView = camera.FieldOfView,
FarPlaneDistance = camera.FarPlaneDistance,
NearPlaneDistance = camera.NearPlaneDistance,
Position = transform.Transform(camera.Position)
};
}
开发者ID:node-net,项目名称:Node.Net,代码行数:12,代码来源:PerspectiveCamera.Extension.cs
示例18: ExportModel
/// <summary>
/// Exports the model.
/// </summary>
/// <param name="model">
/// The model.
/// </param>
/// <param name="inheritedTransform">
/// The inherited transform.
/// </param>
protected override void ExportModel(GeometryModel3D model, Transform3D inheritedTransform)
{
var mesh = model.Geometry as MeshGeometry3D;
if (mesh == null)
{
return;
}
// writer.WriteLine("Transform {");
// todo: add transform from model.Transform and inheritedTransform
this.writer.WriteLine("Shape {");
this.writer.WriteLine(" appearance Appearance {");
// todo: set material properties from model.Material
this.writer.WriteLine(" material Material {");
this.writer.WriteLine(" diffuseColor 0.8 0.8 0.2");
this.writer.WriteLine(" specularColor 0.5 0.5 0.5");
this.writer.WriteLine(" }");
this.writer.WriteLine(" }"); // Appearance
this.writer.WriteLine(" geometry IndexedFaceSet {");
this.writer.WriteLine(" coord Coordinate {");
this.writer.WriteLine(" point [");
foreach (var pt in mesh.Positions)
{
this.writer.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0} {1} {2},", pt.X, pt.Y, pt.Z));
}
this.writer.WriteLine(" ]");
this.writer.WriteLine(" }");
this.writer.WriteLine(" coordIndex [");
for (int i = 0; i < mesh.TriangleIndices.Count; i += 3)
{
this.writer.WriteLine(
string.Format(
CultureInfo.InvariantCulture,
"{0} {1} {2},",
mesh.TriangleIndices[i],
mesh.TriangleIndices[i + 1],
mesh.TriangleIndices[i + 2]));
}
this.writer.WriteLine(" ]");
this.writer.WriteLine(" }"); // IndexedFaceSet
this.writer.WriteLine("}"); // Shape
// writer.WriteLine("}"); // Transform
}
开发者ID:sivarajankumar,项目名称:dentalsmile,代码行数:61,代码来源:VrmlExporter.cs
示例19: CombineTransform
/// <summary>
/// Combines two transforms.
/// Null Values are treated like the Identity transform.
/// </summary>
/// <param name="t1">
/// The first transform.
/// </param>
/// <param name="t2">
/// The second transform.
/// </param>
/// <returns>
/// The combined transform group.
/// </returns>
public static Transform3D CombineTransform(Transform3D t1, Transform3D t2)
{
if (t1 == null && t2 == null)
return Transform3D.Identity;
if (t1 == null && t2 != null)
return t2;
if (t1 != null && t2 == null)
return t1;
var g = new Transform3DGroup();
g.Children.Add(t1);
g.Children.Add(t2);
return g;
}
开发者ID:ondrej11,项目名称:o106,代码行数:26,代码来源:Transform3DHelper.cs
示例20: CalculateRotationMatrix
public static Matrix3D CalculateRotationMatrix(double x, double y, double z, Point3D center, Vector3D up, Vector3D look, Transform3D transform)
{
//Transform3DGroup trm = new Transform3DGroup();
//trm.Children.Add(transform);
up = transform.Transform(up);
look = transform.Transform(look);
center = transform.Transform(center);
Vector3D axisZ = Vector3D.CrossProduct(up, look);
Matrix3D matrix = new Matrix3D();
matrix.RotateAt(new Quaternion(axisZ, x), center);
matrix.RotateAt(new Quaternion(up, y), center);
matrix.RotateAt(new Quaternion(look, z), center);
return matrix;
}
开发者ID:mind0n,项目名称:hive,代码行数:14,代码来源:MatrixHelper.cs
注:本文中的System.Windows.Media.Media3D.Transform3D类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论