CompositeTransform3D Behavior
Out of curiosity, why are elements in the top stack rotated differently compared to the elements in the bottom stack panel? (it is a cut and paste of the same XAML). Even if CompositeTrasnform3D coordinates are global, would the result look like this?
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:noesis="clr-namespace:NoesisGUIExtensions;assembly=Noesis.GUI.Extensions">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Top">
<Grid Width="300" Height="200" Margin="20">
<noesis:Element.Transform3D>
<noesis:CompositeTransform3D RotationY="-5" CenterX="150" />
</noesis:Element.Transform3D>
<Rectangle Fill="Gray"/>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">A</TextBlock>
</Grid>
<Grid Width="300" Height="200" Margin="20">
<noesis:Element.Transform3D>
<noesis:CompositeTransform3D RotationY="5" CenterX="150" />
</noesis:Element.Transform3D>
<Rectangle Fill="Gray"/>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">B</TextBlock>
</Grid>
</StackPanel>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Bottom">
<Grid Width="300" Height="200" Margin="20">
<noesis:Element.Transform3D>
<noesis:CompositeTransform3D RotationY="-5" CenterX="150" />
</noesis:Element.Transform3D>
<Rectangle Fill="Gray"/>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">A</TextBlock>
</Grid>
<Grid Width="300" Height="200" Margin="20">
<noesis:Element.Transform3D>
<noesis:CompositeTransform3D RotationY="5" CenterX="150" />
</noesis:Element.Transform3D>
<Rectangle Fill="Gray"/>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">B</TextBlock>
</Grid>
</StackPanel>
</Grid>
Re: CompositeTrasnform3D Behavior
I was able to achieve the desired behavior through the following:
This is resolved for me now -- this seemed to be an easier approach. Not sure why the above behaves the way it does, however.
Code: Select all
Matrix3D rotation = Matrix3D.Identity;
Transform3D = new MatrixTransform3D(rotation.RotateY(-5));
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: CompositeTrasnform3D Behavior
It is the result of the camera perspective, it is the expected behavior. The CompositeTransform3D matrix is calculated as:why are elements in the top stack rotated differently compared to the elements in the bottom stack panel?
Code: Select all
moveToCenter * scale * rotate * translate * moveFromCenter
Who is online
Users browsing this forum: No registered users and 68 guests