本文整理汇总了C#中System.Windows.Media.Media3D.RotateTransform3D类的典型用法代码示例。如果您正苦于以下问题:C# RotateTransform3D类的具体用法?C# RotateTransform3D怎么用?C# RotateTransform3D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RotateTransform3D类属于System.Windows.Media.Media3D命名空间,在下文中一共展示了RotateTransform3D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CellNet
public CellNet(INetwork network, ModelVisual3D mophology, Dictionary<Guid, ICell> cells, Dictionary<Guid, ICellNet> childcellnet)
{
this.network = network;
this.mophology = mophology;
this.cells = cells;
this.childcellnet = childcellnet;
IsPushing = true;
var transforms = new Transform3DGroup();
Rotate = new RotateTransform3D(new QuaternionRotation3D());
Translate = new TranslateTransform3D(network.Position.X, network.Position.Y, network.Position.Z);
Scale = new ScaleTransform3D();
transforms.Children.Add(Rotate);
transforms.Children.Add(Translate);
transforms.Children.Add(Scale);
Mophology.Transform = transforms;
var binding = new Binding()
{
Source = network,
Path = new PropertyPath("Position"),
Mode = BindingMode.OneWay
};
BindingOperations.SetBinding(this, CellNet.PositionProperty, binding);
}
开发者ID:babaq,项目名称:Soul,代码行数:25,代码来源:CellNet.cs
示例2: GetRotateTransform3D
public static RotateTransform3D GetRotateTransform3D(this XbimMatrix3D m)
{
RotateTransform3D r = new RotateTransform3D();
XbimQuaternion xq = m.GetRotationQuaternion();
r.Rotation = new QuaternionRotation3D(new Quaternion(xq.X, xq.Y, xq.Z, xq.W * (180.0 / Math.PI)));
return r;
}
开发者ID:tnesser,项目名称:XbimWindowsUI,代码行数:7,代码来源:WpfExtensions.cs
示例3: Cell
public Cell(INeuron neuron, ModelVisual3D mophology, Imaging imager)
{
this.neuron = neuron;
this.mophology = mophology;
this.imager = imager;
neuron.Updated += OnUpdated;
neuron.Hillock.Spike += OnSpike;
IsPushing = true;
var transforms = new Transform3DGroup();
Rotate = new RotateTransform3D(new QuaternionRotation3D());
Translate = new TranslateTransform3D(neuron.Position.X, neuron.Position.Y, neuron.Position.Z);
Scale = new ScaleTransform3D();
transforms.Children.Add(Rotate);
transforms.Children.Add(Translate);
transforms.Children.Add(Scale);
Mophology.Transform = transforms;
var binding = new Binding()
{
Source = neuron,
Path = new PropertyPath("Position"),
Mode = BindingMode.OneWay
};
BindingOperations.SetBinding(this, Cell.PositionProperty, binding);
}
开发者ID:babaq,项目名称:Soul,代码行数:26,代码来源:Cell.cs
示例4: 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
示例5: Sphere
// Public constructor to initialize those fields, etc
public Sphere()
{
rotate = new AxisAngleRotation3D();
xform = new RotateTransform3D(rotate);
PropertyChanged(this, new DependencyPropertyChangedEventArgs());
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:Sphere.cs
示例6: Cylinder
// Public constructor to initialize those fields, etc
public Cylinder()
{
rotate = new AxisAngleRotation3D();
xform = new RotateTransform3D(rotate);
PropertyChanged(new DependencyPropertyChangedEventArgs());
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:8,代码来源:Cylinder.cs
示例7: ThrustLine
public ThrustLine(Viewport3D viewport, SharedVisuals sharedVisuals, Vector3D forceDirection, Vector3D localOffset)
{
this.Viewport = viewport;
_forceDirection = forceDirection;
_forceStrength = forceDirection.Length; // this way they don't have to set this if they don't want
this.BodyOffset = new TranslateTransform3D(localOffset); // just setting it to something so it's not null
#region Create Visual
// I'll create the visual, but won't add it until they fire the thruster
// Material
MaterialGroup materials = new MaterialGroup();
materials.Children.Add(new DiffuseMaterial(Brushes.Coral));
materials.Children.Add(new SpecularMaterial(Brushes.Gold, 100d));
// Geometry Model
// Create a skinny 3D rectangle along the x axis
GeometryModel3D geometry = new GeometryModel3D();
geometry.Material = materials;
geometry.BackMaterial = materials;
geometry.Geometry = sharedVisuals.ThrustLineMesh;
// Figure out how much to rotate the cube to be along the opposite of the force line. I do the opposite, because
// thruster flames shoot in the opposite direction that they're pushing
Vector3D flameLine = forceDirection;
flameLine.Negate();
Vector3D axis;
double radians;
Math3D.GetRotation(out axis, out radians, new Vector3D(1, 0, 0), flameLine);
if (radians == 0d)
{
_initialRotate = null;
}
else
{
_initialRotate = new RotateTransform3D(new AxisAngleRotation3D(axis, Math1D.RadiansToDegrees(radians)));
}
//// Transform
//Transform3DGroup transform = new Transform3DGroup(); // rotate needs to be added before translate
//transform.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(axis, Math3D.RadiansToDegrees(radians))));
//transform.Children.Add(new TranslateTransform3D(from));
// Model Visual
_model = new ModelVisual3D();
_model.Content = geometry;
_model.Transform = new TranslateTransform3D(); // I won't do anything with this right now
#endregion
}
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:57,代码来源:ThrustLine.cs
示例8: makeAxisTransform
//Create a rotation transformation about the specified axis by the specified number of degrees anti-clockwise:
public static RotateTransform3D makeAxisTransform(Vector3D axis, double angle)
{
RotateTransform3D myRotateTransform3D = new RotateTransform3D();
AxisAngleRotation3D myAxisAngleRotation3d = new AxisAngleRotation3D();
myAxisAngleRotation3d.Axis = axis;
myAxisAngleRotation3d.Angle = angle; //rotate anticlockwise by the specified angle
myRotateTransform3D.Rotation = myAxisAngleRotation3d;
return myRotateTransform3D;
}
开发者ID:CRogers,项目名称:KinectGroupPractical,代码行数:10,代码来源:Transforms.cs
示例9: Render
public ModelVisual3D Render()
{
_blocks = new GeometryModel3D[_dimension, _dimension, _dimension];
Model3DGroup group = new Model3DGroup();
double space = 0.03;
double w = (1 - space * (_dimension - 1)) / _dimension;
double slot = w + space;
ScaleTransform3D scaling = new ScaleTransform3D(w, w, w);
for (int i = 0; i < _dimension * _dimension * _dimension; i++)
{
int x = i % _dimension;
int y = (int)(i / _dimension) % _dimension;
int z = (int)(i / (_dimension * _dimension));
GeometryModel3D c = CreateMiniCube();
_blocks[x, y, z] = c;
TranslateTransform3D pos = new TranslateTransform3D((slot * x), (slot * y), -(slot * z));
Transform3DGroup tgroup = new Transform3DGroup();
tgroup.Children.Add(scaling);
tgroup.Children.Add(pos);
c.Transform = tgroup;
group.Children.Add(c);
}
Transform3DGroup cubeTransGroup = new Transform3DGroup();
TranslateTransform3D cubePos = new TranslateTransform3D(-0.5, -0.5, 0.5);
cubeTransGroup.Children.Add(cubePos);
// Animation
_spinTransform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), 0));
//Vector3DAnimation myVectorAnimation = new Vector3DAnimation(new Vector3D(0, 0, -1), new Duration(TimeSpan.FromMilliseconds(5000)));
//myVectorAnimation.RepeatBehavior = RepeatBehavior.Forever;
//myRotateTransform.Rotation.BeginAnimation(AxisAngleRotation3D.AxisProperty, myVectorAnimation);
//myRotateTransform.Rotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, doubleAnim);
cubeTransGroup.Children.Add(_spinTransform);
// Animation end
group.Transform = cubeTransGroup;
ModelVisual3D model = new ModelVisual3D();
model.Content = group;
return model;
}
开发者ID:droptableuser,项目名称:embsysengineering,代码行数:57,代码来源:CubeModel.cs
示例10: Trackball
public Trackball(double rotationFactor = 4.0, double zoomFacfor = 1.0) {
_rotationFactor = rotationFactor;
_zoomFactor = zoomFacfor;
_transform = new Transform3DGroup();
_transform.Children.Add(_scale);
_rotateTransform = new RotateTransform3D(_rotation);
_transform.Children.Add(_rotateTransform);
_transform.Children.Add(_translate);
}
开发者ID:whztt07,项目名称:Osm3DBuildingGenerator,代码行数:9,代码来源:TrackBall.cs
示例11: Move
public void Move(double offsetX, double offsetY, double offsetZ, double angle)
{
Transform3DGroup transform = new Transform3DGroup();
RotateTransform3D rotateTrans = new RotateTransform3D();
rotateTrans.Rotation = new AxisAngleRotation3D(new Vector3D(0, 1, 0), angle);
TranslateTransform3D translateTrans = new TranslateTransform3D(offsetX, offsetY, offsetZ);
transform.Children.Add(rotateTrans);
transform.Children.Add(translateTrans);
this.Transform = transform;
}
开发者ID:uwitec,项目名称:gloryview-rfid,代码行数:10,代码来源:ModelWall.cs
示例12: Cube
public Cube(Viewport3D myViewport3D, float obesity)
{
this.up = ((PerspectiveCamera)myViewport3D.Camera).UpDirection;
this.trans = new Transform3DGroup();
this.scale = new ScaleTransform3D();
this.translation = new TranslateTransform3D();
this.rotation = new RotateTransform3D();
this.axis = new AxisAngleRotation3D();
this.obesity = obesity;
this.cube = new Model3DGroup();
Point3D p0 = new Point3D(-1, -1, -1);
Point3D p1 = new Point3D(1, -1, -1);
Point3D p2 = new Point3D(1, -1, 1);
Point3D p3 = new Point3D(-1, -1, 1);
Point3D p4 = new Point3D(-1, 0, -1);
Point3D p5 = new Point3D(1, 0, -1);
Point3D p6 = new Point3D(1, 0, 1);
Point3D p7 = new Point3D(-1, 0, 1);
//front side triangles
cube.Children.Add(CreateTriangleModel(p3, p2, p6));
cube.Children.Add(CreateTriangleModel(p3, p6, p7));
//right side triangles
cube.Children.Add(CreateTriangleModel(p2, p1, p5));
cube.Children.Add(CreateTriangleModel(p2, p5, p6));
//back side triangles
cube.Children.Add(CreateTriangleModel(p1, p0, p4));
cube.Children.Add(CreateTriangleModel(p1, p4, p5));
//left side triangles
cube.Children.Add(CreateTriangleModel(p0, p3, p7));
cube.Children.Add(CreateTriangleModel(p0, p7, p4));
//top side triangles
cube.Children.Add(CreateTriangleModel(p7, p6, p5));
cube.Children.Add(CreateTriangleModel(p7, p5, p4));
//bottom side triangles
cube.Children.Add(CreateTriangleModel(p2, p3, p0));
cube.Children.Add(CreateTriangleModel(p2, p0, p1));
this.model = new ModelVisual3D();
this.model.Content = cube;
this.myDirectionalLight = new DirectionalLight();
this.myDirectionalLight.Color = Colors.Green;
this.myDirectionalLight.Direction = new Vector3D(-2, -3, 1);
this.cube.Children.Add(myDirectionalLight);
myViewport3D.Children.Add(model);
trans.Children.Add(scale);
trans.Children.Add(rotation);
trans.Children.Add(translation);
this.cube.Transform = trans;
}
开发者ID:countable,项目名称:Kinect3D,代码行数:55,代码来源:Cube.cs
示例13: UserControl1
public UserControl1()
{
InitializeComponent();
ax3d = new AxisAngleRotation3D(new Vector3D(0, 2, 0), 1);
RotateTransform3D myRotateTransform = new RotateTransform3D(ax3d);
var ModelVisual3D = this.GetModel();
MatrixTransform3D mTransform = new MatrixTransform3D();
ModelVisual3D.Transform = myRotateTransform;
//model
////
}
开发者ID:JimmHub,项目名称:odoStuff,代码行数:14,代码来源:UserControl1.xaml.cs
示例14: AddBone
private static void AddBone(MeshGeometry3D mesh, Point3D startPoint, Point3D endPoint)
{
AxisAngleRotation3D rotate = new AxisAngleRotation3D();
RotateTransform3D xform = new RotateTransform3D(rotate);
Vector3D boneVec = endPoint - startPoint;
// radius always points towards -Z (when possible)
Vector3D radius;
if (boneVec.X == 0 && boneVec.Y == 0)
{
// Special case.
radius = new Vector3D(0, -1, 0);
}
else
{
// Find vector axis 90 degrees from bone where Z == 0
rotate.Axis = Vector3D.CrossProduct(boneVec, new Vector3D(0, 0, 1));
rotate.Angle = -90;
// Rotate 90 degrees to find radius vector
radius = boneVec * xform.Value;
radius.Normalize();
}
// Rotate the radius around the bone vector
rotate.Axis = boneVec;
var positions = mesh.Positions;
const int slices = 10;
for (int slice = 0; slice < slices; ++slice)
{
// Rotate radius vector
rotate.Angle = slice * 360.0 / slices;
Vector3D vectRadius = radius * xform.Value;
rotate.Angle = (slice + 1) * 360.0 / slices;
Vector3D vectRadius1 = radius * xform.Value;
// Bit of a hack to avoid having to set the normals or worry about consistent winding.
positions.Add(startPoint);
positions.Add(endPoint + delta * vectRadius);
positions.Add(endPoint + delta * vectRadius1);
positions.Add(startPoint);
positions.Add(endPoint + delta * vectRadius1);
positions.Add(endPoint + delta * vectRadius);
}
}
开发者ID:Stranho,项目名称:bgda-explorer,代码行数:49,代码来源:SkeletonProcessor.cs
示例15: VerticalTransform
private void VerticalTransform(bool upDown, double angleDeltaFactor)
{
Vector3D postion = new Vector3D(myPerspectiveCamera.Position.X, myPerspectiveCamera.Position.Y, myPerspectiveCamera.Position.Z);
Vector3D rotateAxis = Vector3D.CrossProduct(postion, myPerspectiveCamera.UpDirection);
RotateTransform3D rt3d = new RotateTransform3D();
AxisAngleRotation3D rotate = new AxisAngleRotation3D(rotateAxis, angleDeltaFactor * (upDown ? -1 : 1));
rt3d.Rotation = rotate;
Matrix3D matrix = rt3d.Value;
Point3D newPostition = matrix.Transform(myPerspectiveCamera.Position);
myPerspectiveCamera.Position = newPostition;
myPerspectiveCamera.LookDirection = new Vector3D(-newPostition.X, -newPostition.Y, -newPostition.Z);
Vector3D newUpDirection = Vector3D.CrossProduct(myPerspectiveCamera.LookDirection, rotateAxis);
newUpDirection.Normalize();
myPerspectiveCamera.UpDirection = newUpDirection;
}
开发者ID:uwitec,项目名称:gloryview-rfid,代码行数:15,代码来源:motor.xaml.cs
示例16: Cylinder
// Public constructor to initialize those fields, etc
public Cylinder()
{
rotate = new AxisAngleRotation3D();
xform = new RotateTransform3D(rotate);
MeshGeometry3D mesh = (MeshGeometry3D)Geometry;
mesh.Positions = new Point3DCollection((Slices + 1) * (Stacks + 5) - 2);
mesh.Normals = new Vector3DCollection((Slices + 1) * (Stacks + 5) - 2);
mesh.TriangleIndices = new Int32Collection(6 * Slices * (Stacks + 1));
mesh.TextureCoordinates = new PointCollection((Slices + 1) * (Stacks + 5) - 2);
// Initialize all collection based on default properties
GeneratePositions();
GenerateTriangleIndices();
GenerateTextureCoordinates();
}
开发者ID:shimins,项目名称:Eyetracking,代码行数:17,代码来源:Cylinder.cs
示例17: RenderSomeModels
private void RenderSomeModels()
{
myViewport.Name = "myViewport";
//Set camera viewpoint and properties.
myPCamera.FarPlaneDistance = 20;
myPCamera.NearPlaneDistance = 1;
myPCamera.FieldOfView = 45;
myPCamera.Position = new Point3D(-5, 2, 3);
myPCamera.LookDirection = new Vector3D(5, -2, -3);
myPCamera.UpDirection = new Vector3D(0, 1, 0);
//Add light sources to the scene.
myDirLight.Color = Colors.White;
myDirLight.Direction = new Vector3D(-3, -4, -5);
teapotModel.Geometry = (MeshGeometry3D)Application.Current.Resources["myTeapot"];
//Define DiffuseMaterial and apply to the mesh geometries.
DiffuseMaterial teapotMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.Blue));
//Define a transformation
RotateTransform3D myRotateTransform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 2, 0), 1));
//Define an animation for the transformation
DoubleAnimation myAnimation = new DoubleAnimation();
myAnimation.From = 1;
myAnimation.To = 361;
myAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(5000));
myAnimation.RepeatBehavior = RepeatBehavior.Forever;
//Add animation to the transformation
myRotateTransform.Rotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, myAnimation);
//Add transformation to the model
teapotModel.Transform = myRotateTransform;
teapotModel.Material = teapotMaterial;
//Add the model to the model group collection
modelGroup.Children.Add(teapotModel);
modelGroup.Children.Add(myDirLight);
myViewport.Camera = myPCamera;
myModelVisual3D.Content = modelGroup;
myViewport.Children.Add(myModelVisual3D);
//add the Viewport3D to the window
mainWindow.Content = myViewport;
}
开发者ID:jayawantsawant,项目名称:WPFSamples,代码行数:46,代码来源:MainWindow.xaml.cs
示例18: WorkShop
public WorkShop()
{
InitializeComponent();
var network = new Network();
var solver = new ODESolver();
var recorder = new Recorder(Simulator, RecordType.None, "Soul");
Simulator = new Simulator(0.01, 50, network, solver, recorder);
IsReportProgress = true;
CellNet = new CellNet(network);
IsImaging = true;
var transformGroup = new Transform3DGroup();
TranslateTransform = new TranslateTransform3D();
RotateTransform = new RotateTransform3D(new QuaternionRotation3D());
ScaleTransform = new ScaleTransform3D();
transformGroup.Children.Add(TranslateTransform);
transformGroup.Children.Add(RotateTransform);
transformGroup.Children.Add(ScaleTransform);
ModelVisual.Transform = transformGroup;
ActionType = ActionType.None;
MouseLeftButtonDown += WorkShop_MouseLeftButtonDown;
MouseLeftButtonUp += WorkShop_MouseLeftButtonUp;
MouseRightButtonDown += WorkShop_MouseRightButtonDown;
MouseRightButtonUp += WorkShop_MouseRightButtonUp;
MouseMove += WorkShop_MouseMove;
MouseWheel += WorkShop_MouseWheel;
var n = new LI(-50, -48, 5, 2, -55);
var net0 = Proliferation.Division(n, new Point3D(1, 10, 10), "InitPotential", new Randomizer(new RNG(), dimyend: 9, dimzend: 9, mean: -50.0, std: 5));
net0.ReSet();
//net0.ReShape(new Point3D(2, 10, 5));
var net1 = Proliferation.Division(n, new Point3D(1, 10, 10), "InitPotential", new Randomizer(new RNG(), dimyend: 9, dimzend: 9, mean: -50.0, std: 10));
net1.ReSet();
Projection.From_To(net0, net1, new WeightSynapse(null, 1), ProjectionType.OneToOne, 1.0);
Projection.From_To(net0, net0, new WeightSynapse(null, -0.4), ProjectionType.AllToAll, 0.3);
Projection.From_To(net1, net0, new WeightSynapse(null, -0.1), ProjectionType.AllToAll, 0.5);
Projection.From_To(net1, net1, new WeightSynapse(null, 0.1), ProjectionType.OneToOne, 0.8);
var net = new Network();
net.ChildNetworks.Add(net0.ID, net0);
net.ChildNetworks.Add(net1.ID, net1);
LoadNetwork(net);
CellNet.ChildCellNet[net0.ID].Position = new Point3D(-15, 0, 15);
}
开发者ID:babaq,项目名称:Soul,代码行数:45,代码来源:WorkShop.xaml.cs
示例19: Filter_FilterUpdate
private void Filter_FilterUpdate(object sender, EventArgs e)
{
Quaternion corrected = new Quaternion();
corrected.X = filter.Transform.Y;
corrected.Y = filter.Transform.Z;
corrected.Z = -filter.Transform.X;
corrected.W = filter.Transform.W;
var transform = new QuaternionRotation3D(corrected);
Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
{
var rot = new RotateTransform3D();
rot.Rotation = transform;
Transform = new MatrixTransform3D(rot.Value);
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Transform"));
}));
}
开发者ID:treehopper-electronics,项目名称:treehopper-sdk,代码行数:20,代码来源:MainWindow.xaml.cs
示例20: ElementCloud
public ElementCloud()
{
this.Background = Brushes.Transparent;
canvas = new Canvas()
{
VerticalAlignment = VerticalAlignment.Stretch,
HorizontalAlignment = HorizontalAlignment.Stretch
};
this.Children.Add(canvas);
rotateTransform = new RotateTransform3D();
SizeChanged += OnPageSizeChanged;
rotationType = RotationType.Mouse;
rotateDirection = new Point(100, 0);
slowDownCounter = 500;
elementsCollection = new List<ElementCloudItem>();
scaleRatio = 0.09;
opacityRatio = 1.3;
}
开发者ID:BBuchholz,项目名称:NineWorldsDeep,代码行数:21,代码来源:ElementCloud.cs
注:本文中的System.Windows.Media.Media3D.RotateTransform3D类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论