本文整理汇总了C#中System.Windows.Media.Media3D.TranslateTransform3D类的典型用法代码示例。如果您正苦于以下问题:C# TranslateTransform3D类的具体用法?C# TranslateTransform3D怎么用?C# TranslateTransform3D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TranslateTransform3D类属于System.Windows.Media.Media3D命名空间,在下文中一共展示了TranslateTransform3D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: MotionWindow_Loaded
void MotionWindow_Loaded(object sender, RoutedEventArgs e)
{
Transform3DGroup gp = new Transform3DGroup();
uBase.Load(@"3DModules\upper.xaml");
ScaleTransform3D sc = new ScaleTransform3D(12, 12, 1, 0, 0, 0);
TranslateTransform3D tt = new TranslateTransform3D(0, 0, -15.5);
gp.Children.Add(sc);
gp.Children.Add(tt);
uBase.Transform = gp;
uPlatform.Load(@"3DModules\platform.xaml");
upper.Load(@"3DModules\upper.xaml");
AbsoluteVisual.AddLight(Colors.Wheat, new Vector3D(-1, -1, -1), Colors.Gray);
vpMain.PlaceCamera(
new Point3D(0, 0, 500),
new Vector3D(0, 0, -1),
new Vector3D(0, 1, 0),
45
);
AbsoluteVisual.Children.Add(uBase);
AbsoluteVisual.Children.Add(uPlatform);
AbsoluteVisual.Children.Add(upper);
ca = new EventCameraAgent(vpMain);
ca.MouseLockRelPos = new Point(1, 1);
ca.BindEventTo(this);
ca.OnCameraStatusChange += new CameraAgent.CameraTransformHandler(ca_OnCameraStatusChange);
}
示例4: ConvertOne
public GeometryModel3D ConvertOne( EngineViewModel engine )
{
var white = Color.FromRgb(255, 255, 255);
var whiteBrush = new SolidColorBrush(white);
var model = new GeometryModel3D(GetGeometry(), new DiffuseMaterial(whiteBrush));
var transform = new Transform3DGroup();
var scaleTransform = new ScaleTransform3D();
var translateTransform = new TranslateTransform3D();
transform.Children.Add(scaleTransform);
transform.Children.Add(translateTransform);
scaleTransform.ScaleX = 3;
scaleTransform.ScaleY = 3;
var powerBinding = new Binding("Power") {Mode = BindingMode.OneWay, Source = engine};
BindingOperations.SetBinding(
scaleTransform,
ScaleTransform3D.ScaleZProperty,
powerBinding);
translateTransform.OffsetX = engine.OffsetX;
translateTransform.OffsetY = engine.OffsetY;
model.Transform = transform;
return model;
}
示例5: 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);
}
示例6: BlipVisual
public BlipVisual(Visual3D visual, bool isVisualUpright, TranslateTransform3D translate, AxisAngleRotation3D rotate)
{
this.Visual = visual;
this.IsVisualUpright = isVisualUpright;
this.Translate = translate;
this.Rotate = rotate;
}
示例7: 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;
}
示例8: makeTranslateTransform
//Create a translation transformation. The first argument translates in x, the next in y and the last in z:
public static TranslateTransform3D makeTranslateTransform(double xTrans, double yTrans, double zTrans)
{
TranslateTransform3D myTranslateTransform3D = new TranslateTransform3D();
myTranslateTransform3D.OffsetX = xTrans;
myTranslateTransform3D.OffsetY = yTrans;
myTranslateTransform3D.OffsetZ = zTrans;
return myTranslateTransform3D;
}
示例9: RenderController
RenderController()
{
entity.Content = modelGroup;
TranslateTransform3D translateTransform = new TranslateTransform3D(0, 0, -300);
transformGroup.Children.Add(new RotateTransform3D());
transformGroup.Children.Add(translateTransform);
entity.Transform = transformGroup;
}
示例10: 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;
}
示例11: Node
public Node(NodeTemplate template)
{
Translation = new TranslateTransform3D();
PrimaryRotation = new AxisAngleRotation3D(template.Axis, 0);
Transform3DGroup group = new Transform3DGroup();
group.Children.Add(new RotateTransform3D(PrimaryRotation, template.Center));
group.Children.Add(Translation);
Transform = group;
}
示例12: 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;
}
示例13: 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;
}
示例14: Dot
public Dot(bool isStatic, Point3D position)
{
this.IsStatic = isStatic;
_position = position;
ModelVisual3D model = BuildDot(isStatic);
this.Visual = model;
_transform = new TranslateTransform3D(position.ToVector());
model.Transform = _transform;
}
示例15: Dot
public Dot(bool isStatic, Point3D position, double repulseMult = 1d)
{
this.IsStatic = isStatic;
_position = position;
this.RepulseMult = repulseMult;
ModelVisual3D model = BuildDot(isStatic, repulseMult);
this.Visual = model;
_transform = new TranslateTransform3D(position.ToVector());
model.Transform = _transform;
}