本文整理汇总了C#中System.Windows.Media.Media3D.Transform3DGroup类的典型用法代码示例。如果您正苦于以下问题:C# Transform3DGroup类的具体用法?C# Transform3DGroup怎么用?C# Transform3DGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Transform3DGroup类属于System.Windows.Media.Media3D命名空间,在下文中一共展示了Transform3DGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNextTransformation
/**
* Creates transformation group for the object in the list, it can be rotated, translated, scaled, as layout class wish :)
* \return transformation group for the object in the list
*/
public Transform3DGroup GetNextTransformation()
{
Point3D p = new Point3D();
p.X = 1.8f * Math.Cos(counter * 0.17 * 30.0);
p.Y = 1.2f * Math.Sin(counter * 0.17 * 30.0);
p.Z = -counter;
if (p.Z < maxDist) maxDist = p.Z;
++counter;
Transform3DGroup group = new Transform3DGroup();
group.Children.Add(new ScaleTransform3D
{
ScaleX = 1.0,
ScaleY = 1.0,
ScaleZ = 1.0
});
group.Children.Add(new RotateTransform3D
{
Rotation = new AxisAngleRotation3D
{
Angle = 35,
Axis = new Vector3D(1, 1, 1)
}
});
group.Children.Add(new TranslateTransform3D
{
OffsetX = p.X,
OffsetY = p.Y,
OffsetZ = p.Z
});
return group;
}
示例2: Trackball
public Trackball()
{
_transform = new Transform3DGroup();
_transform.Children.Add( _scale );
_transform.Children.Add( new RotateTransform3D( _rotation ) );
_transform.Children.Add( _translation );
}
示例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: Setup3DItem
public void Setup3DItem(Model3DGroup targetGroup, DiffuseMaterial diffuseMaterialBrushPair,
Size size, Point center, Material backMaterial, Rect backTextureCoordinates)
{
_locationDesired = new Point3D(center.X, center.Y, 0);
_locationCurrent = new Point3D(0, 0, Rnd.NextDouble() * 10 - 20);
_size = size;
Point3D topLeft = new Point3D(-size.Width / 2, size.Height / 2, 0);
Point3D topRight = new Point3D(size.Width / 2, size.Height / 2, 0);
Point3D bottomLeft = new Point3D(-size.Width / 2, -size.Height / 2, 0);
Point3D bottomRight = new Point3D(size.Width / 2, -size.Height / 2, 0);
DiffuseMaterial = diffuseMaterialBrushPair;
_quad.Children.Add(
CreateTile(
diffuseMaterialBrushPair,
backMaterial,
_borderMaterial,
new Size3D(size.Width, size.Height, .01),
backTextureCoordinates));
Transform3DGroup group = new Transform3DGroup();
group.Children.Add(new RotateTransform3D(_verticalFlipRotation));
group.Children.Add(new RotateTransform3D(this._quaternionRotation3D));
group.Children.Add(_scaleTransform);
group.Children.Add(_translate);
_quad.Transform = group;
targetGroup.Children.Add(_quad);
}
示例5: 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;
}
示例6: FlipTile
public FlipTile(DiffuseMaterial frontMaterial,
Size size, Point center, Material backMaterial, Rect backTextureCoordinates)
{
m_locationDesired = new Point3D(center.X, center.Y, 0);
m_locationCurrent = new Point3D(0, 0, Util.Rnd.NextDouble() * 10 - 20);
m_size = size;
Point3D topLeft = new Point3D(-size.Width / 2, size.Height / 2, 0);
Point3D topRight = new Point3D(size.Width / 2, size.Height / 2, 0);
Point3D bottomLeft = new Point3D(-size.Width / 2, -size.Height / 2, 0);
Point3D bottomRight = new Point3D(size.Width / 2, -size.Height / 2, 0);
m_frontMaterial = frontMaterial;
Model3DGroup quad = new Model3DGroup();
quad.Children.Add(
CreateTile(
frontMaterial,
backMaterial,
m_borderMaterial,
new Size3D(size.Width, size.Height, .01),
backTextureCoordinates));
Transform3DGroup group = new Transform3DGroup();
group.Children.Add(new RotateTransform3D(m_verticalFlipRotation));
group.Children.Add(new RotateTransform3D(m_quaternionRotation3D));
group.Children.Add(m_scaleTransform);
group.Children.Add(m_translate);
quad.Transform = group;
this.Visual3DModel = quad;
}
示例7: 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);
}
示例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;
}
示例9: CreateTransformGroup
public Transform3DGroup CreateTransformGroup(Halo3.ObjectChunk placedObject)
{
var transformGroup = new Transform3DGroup();
float yaw, pitch, roll;
Core.Helpers.VectorMath.Convert.ToYawPitchRoll(
placedObject.SpawnPosition.Right,
placedObject.SpawnPosition.Forward,
placedObject.SpawnPosition.Up,
out yaw,
out pitch,
out roll);
// For some reason you have to swag the roll and yaw.
var swag = Microsoft.Xna.Framework.Quaternion.CreateFromYawPitchRoll(roll, pitch, yaw);
// Apply 3D Matrix
var matrix = new Matrix3D();
matrix.Rotate(new Quaternion(swag.X, swag.Y, swag.Z, swag.W));
matrix.OffsetX = placedObject.SpawnCoordinates.X;
matrix.OffsetY = placedObject.SpawnCoordinates.Y;
matrix.OffsetZ = placedObject.SpawnCoordinates.Z;
// TODO: FUCK THIS VALUE
// TODO: AND FUCK BUNGIE
//matrix.Prepend(new Matrix3D
// {
// OffsetX = 0,
// OffsetY = 0,
// OffsetZ = 0
// });
transformGroup.Children.Add(new MatrixTransform3D(matrix));
return transformGroup;
}
示例10: 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);
}
示例11: PartAnimation
protected override Matrix3D PartAnimation( string partName )
{
if( partName == "propeller" )
{
Transform3DGroup group = new Transform3DGroup( );
group.Children.Add(
new TranslateTransform3D( -hubOffsetX, -hubOffsetY, -propZOffset ) );
group.Children.Add(
new RotateTransform3D(
new AxisAngleRotation3D( new Vector3D( 1, 0, 0 ), -propAngle ), 0, 0, 0 ) );
group.Children.Add(
new RotateTransform3D(
new AxisAngleRotation3D( new Vector3D( 0, 0, 1 ), propRotation ), 0, 0, 0 ) );
group.Children.Add(
new RotateTransform3D(
new AxisAngleRotation3D( new Vector3D( 1, 0, 0 ), +propAngle ), 0, 0, 0 ) );
group.Children.Add(
new TranslateTransform3D( +hubOffsetX, +hubOffsetY, +propZOffset ) );
propRotation += 11;
return group.Value;
}
else
{
return Matrix3D.Identity;
}
}
示例12: 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;
}
示例13: Window1
public Window1()
{
InitializeComponent();
Flickr.Initialize();
cv = new PhotoCarouselView();
ps = new PhotoStack3D();
Transform3DGroup cvTG = new Transform3DGroup();
cvTG.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 5)));
cvTG.Children.Add(new TranslateTransform3D(0, 0, -1));
cv.Transform = cvTG;
Transform3DGroup tg = new Transform3DGroup();
tg.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), -13)));
tg.Children.Add(new TranslateTransform3D(0, ps.Height / 2, -1.2));
ps.Transform = tg;
MainViewport.Children.Add(cv);
MainViewport.Children.Add(ps);
cv.ItemClickedOn += new PhotoBrowser.CarouselView.CarouselView.ItemClickedOnEvent(cv_ItemClickedOn);
cv.GeoLocationAvailable += new PhotoCarouselView.GeoEventHandler(cv_GeoLocationAvailable);
cv.GeoLocationHidden += new PhotoCarouselView.GeoEventHandler(cv_GeoLocationHidden);
ps.GeoLocationSelected += new PhotoStack3D.GeoLocationSelectedDelegate(ps_GeoLocationSelected);
ps.SelectionChanged += new PhotoBrowser.Stack3D.Stack3D.StackSelectionChangedEvent(ps_SelectionChanged);
ps.BlogRequested += new PhotoStack3D.BlogRequestedDelegate(ps_BlogRequested);
// create the globe we'll use
earth = new InteractiveSphere();
mapVisual = new MapVisual();
mapVisual.searchMenuItem.Click += new RoutedEventHandler(searchMenuItem_Click);
earth.Visual = mapVisual;
// create the transformation applied to the globe
earthTransform = new Transform3DGroup();
Point3D earthPos = new Point3D(-0.2, 0.05, -1.1);
Vector3D earthToCam = new Vector3D(0 - earthPos.X,
0 - earthPos.Y,
0 - earthPos.Z);
earthToCam.Normalize();
earthTransform.Children.Add(new ScaleTransform3D(0.0, 0.0, 0.0));
_myQuaternionRotLong = new QuaternionRotation3D(new Quaternion(new Vector3D(0, 1, 0), 0));
_myQuaternionRotLat = new QuaternionRotation3D(new Quaternion(new Vector3D(1, 0, 0), 0));
earthTransform.Children.Add(new RotateTransform3D(_myQuaternionRotLong));
earthTransform.Children.Add(new RotateTransform3D(_myQuaternionRotLat));
earthTransform.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0),
Math.Acos(Vector3D.DotProduct(new Vector3D(0, 0, 1), earthToCam)) / Math.PI * 180)));
earthTransform.Children.Add(new TranslateTransform3D((Vector3D)earthPos));
earth.Transform = earthTransform;
// add in the earth
HookUpEarthEvents();
}
示例14: Element
public Element()
{
// TODO: Add custom rotation and (optional) scaling
Transform3DGroup group = new Transform3DGroup();
group.Children.Add(new RotateTransform3D(Rotation, 0.5, 0, 0.5));
group.Children.Add(Translation);
Transform = group;
}
示例15: ToMatrix3DLH
/// <summary>
/// Returns the world*perspective matrix for the camera
/// </summary>
/// <param name="camera">The WPF camera</param>
/// <param name="aspectRatio">The aspect ratio of the device surface</param>
/// <returns></returns>
public static Matrix3D ToMatrix3DLH( this PerspectiveCamera camera, double aspectRatio )
{
Transform3DGroup tg = new Transform3DGroup( );
tg.Children.Add(new MatrixTransform3D(GetLookAtMatrixLH(camera)));
tg.Children.Add(camera.Transform);
tg.Children.Add(new MatrixTransform3D(GetPerspectiveMatrixLH(camera, aspectRatio)));
return tg.Value;
}