Model3dsPreserveScaleAspectRatio Property |
Namespace: Ab3d.Visuals
The size of the shown object is controlled by the SizeX, SizeY, SizeZ and PreserveScaleAspectRatio properties.
By default all the SizeX, SizeY and SizeZ are set to -1. This means that the original size of the object is used. But if the SizeX is set to let's say 100, the object would be scaled so its SizeX would be 100.
If PreserveScaleAspectRatio is true (default), than the aspect ratio of the 3D model is preserved. This means that the model is stretched to one side mode than to the other - the scale is evenly set to all the axis. This also means that if all SizeX, SizeY and SizeZ are defined, the object will be scaled so it will not exceed and of the specified sizes.
If PreserveScaleAspectRatio is false, than the aspect ration of the 3D model will not be preserved. In this case the SizeX, SizeY and SizeZ will be applied so the object will be exactly the size of the specified sizes.
The following example shown a 3D model from ab3d.3ds file. The model's center is positioned at (-250, 0, 0) and its size is set so its SizeX is 80. Note that by default the PreserveScaleAspectRatio is set to true.
<model3ds:Model3ds Source="/Resources/ab3d.3ds" SizeX="80" Position="0 40 0" PositionType="Center"/>
The following code shows the same mode, but this time it is custom sized:
<model3ds:Model3ds Source="/Resources/ab3d.3ds" SizeX="50" SizeY="30" SizeZ="40" PreserveScaleAspectRatio="False" Position="0 40 0" PositionType="Center"/>