Ab3d.PowerToys 3D Lines
<Page x:Class="Ab3d.PowerToys.Samples.Lines3D.Lines3DSample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cameras="clr-namespace:Ab3d.Cameras;assembly=Ab3d.PowerToys"
xmlns:ab3d="clr-namespace:Ab3d.Controls;assembly=Ab3d.PowerToys"
xmlns:visuals="clr-namespace:Ab3d.Visuals;assembly=Ab3d.PowerToys">
<Grid Name="MainGrid">
<Grid.Background>
<LinearGradientBrush StartPoint="0 0" EndPoint="0 1">
<GradientStop Offset="0" Color="#033C62"/>
<GradientStop Offset="1" Color="#01131F"/>
</LinearGradientBrush>
</Grid.Background>
<Viewport3D Name="MainViewport">
<visuals:LineVisual3D StartPosition="-50,0,220" EndPosition="50,0,220" LineColor="Silver" LineThickness="1"/>
<visuals:LineVisual3D StartPosition="-50,0,200" EndPosition="50,0,200" LineColor="Silver" LineThickness="3"/>
<visuals:LineVisual3D StartPosition="-50,0,180" EndPosition="50,0,180" LineColor="Silver" LineThickness="5"/>
<visuals:LineVisual3D StartPosition="-50,0,140" EndPosition="50,0,140" LineColor="Silver"
LineThickness="3" StartLineCap="ArrowAnchor" EndLineCap="ArrowAnchor"/>
<visuals:LineVisual3D StartPosition="-50,0,120" EndPosition="50,0,120" LineColor="Silver"
LineThickness="3" EndLineCap="ArrowAnchor"/>
<visuals:LineVisual3D StartPosition="-50,0,100" EndPosition="50,0,100" LineColor="Silver"
LineThickness="3" StartLineCap="ArrowAnchor"/>
<visuals:RectangleVisual3D Position="-50,0,-50" Size="100 100" HeightDirection="0 0 -1"
WidthDirection="1 0 0" LineColor="Silver" LineThickness="5"/>
<visuals:PolyLineVisual3D Positions="100,0,50 200,0,50 150,0,-20" IsClosed="True" LineColor="Silver" LineThickness="5"/>
<visuals:PolyLineVisual3D Positions="100,0,100 130,0,130 160,0,100 190,0,130" StartLineCap="ArrowAnchor"
LineColor="Silver" LineThickness="3"/>
<visuals:PolyLineVisual3D Positions="100,0,130 130,0,160 160,0,130 190,0,160" LineColor="Silver" LineThickness="3"/>
<visuals:PolyLineVisual3D Positions="100,0,160 130,0,190 160,0,160 190,0,190" EndLineCap="ArrowAnchor"
LineColor="Silver" LineThickness="3"/>
<visuals:LineArcVisual3D CircleCenterPosition="150,0,-100" Radius="50" StartAngle="0" EndAngle="270"
CircleNormal="0 1 0" ZeroAngleDirection="1 0 0"
LineColor="Silver" LineThickness="3"/>
<visuals:WireCrossVisual3D Position="150,0,-100" LinesLength="10" LineColor="Silver" LineThickness="1"/>
<!-- NOTE: The default colors of the axis are Red: X, Green: Y, Blue:Z - it is simple to remember the colors: RGB = XYZ -->
<visuals:ColoredAxisVisual3D Length="50"/>
<visuals:MultiLineVisual3D Positions="-50,0,-100 -50,0,-150 -25,0,-100 -25,0,-150 0,0,-100 0,0,-150 25,0,-100 25,0,-150 50,0,-100 50,0,-150"
LineColor="Silver" EndLineCap="ArrowAnchor"/>
<visuals:WireCrossVisual3D Position="-150 0 130" LinesLength="10" LineColor="Silver" LineThickness="1"/>
<visuals:WireCrossVisual3D Position="-130 0 130" LinesLength="20" LineColor="Silver" LineThickness="2"/>
<visuals:WireCrossVisual3D Position="-100 0 130" LinesLength="30" LineColor="Silver" LineThickness="2"/>
<visuals:WireGridVisual3D CenterPosition="-120 0 -50" Size="60 60" WidthCellsCount="5" HeightCellsCount="5"
LineColor="Silver" LineThickness="2"/>
<visuals:WireGridVisual3D CenterPosition="-120 0 50" Size="60 60" IsClosed="True" WidthCellsCount="5"
HeightCellsCount="5" LineColor="Silver" LineThickness="2"/>
<visuals:WireBoxVisual3 CenterPosition="0 0 -260" Size="100 30 60" LineColor="Silver" LineThickness="2"/>
</Viewport3D>
<cameras:SceneCamera Name="Camera1" Heading="30" Attitude="-20" Bank="0" Distance="700" ShowCameraLight="Always"/>
<!-- EventsSourceElement is set to MainGrid - this means that the MainGrid's mouse events are subscribed to -
this enables camera rotation without the need to be over the rendered 3D element -->
<ab3d:MouseCameraController Name="MouseCameraController1" UsedMouseButton="Left" EventsSourceElement="{Binding ElementName=MainGrid}"/>
<ab3d:CameraControlPanel VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="5" Width="150" Height="75"/>
<TextBlock FontWeight="Bold" FontSize="20" Foreground="Silver" Margin="10" VerticalAlignment="Top" HorizontalAlignment="Left"
Text="3D lines and 3D axis created with Ab3d.Visuals"/>
</Grid>
</Page>