|
IFitIntoViewCameraFitIntoView(IListPoint3D, Boolean, Double, Boolean) Method |
FitIntoView adjusts the camera's Distance (for PerspectiveCamera) or CameraWidth (for OrthographicCamera) and TargetPosition (if adjustTargetPosition is true)
so that all the specified positions will be visible from one edge of the viewport to another edge.
Namespace: Ab3d.CamerasAssembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.2.9104.2045
Syntax bool FitIntoView(
IList<Point3D> positions,
bool adjustTargetPosition = true,
double adjustmentFactor = 1,
bool waitUntilCameraIsValid = true
)
Parameters
- positions IListPoint3D
- IList of Point3D that defines the positions that will be used to fit into view
- adjustTargetPosition Boolean (Optional)
- true if the TargetPosition is adjusted; false if TargetPosition is preserved (default value is true)
- adjustmentFactor Double (Optional)
- factor that is multiplied by the calculated Distance or CameraWidth. Can be used to add margin to the bounds - for example value 1.1 would add 10% margin. Default value is 1.0 (no margin).
- waitUntilCameraIsValid Boolean (Optional)
- when true (by default) and if the camera is not valid (for example because the Viewport3D size is not defined yet), then the FitIntoView will be called when the camera becomes valid. When false, then FitIntoView is called only if camera is currently valid. See return value for info if camera was changed.
Return Value
Booleantrue if camera was changed; false when camera is not valid (see waitUntilCameraIsValid parameter for more info)
Remarks FitIntoView adjusts the camera's Distance (for PerspectiveCamera) or CameraWidth (for OrthographicCamera) and TargetPosition (if adjustTargetPosition is true)
so that all the specified Rect3D will be visible from one edge of the viewport to another edge.
The adjustmentFactor parameter can be used to set the margin around the scene objects.
Its value is multiplied by the calculated Distance or CameraWidth. For example value 1.1 would add 10% margin around scene objects.
When using OrthographicCamera, the returned CameraWidth and the new TargetPosition will exactly position the object to the bounds of the Viewport3D.
When using PerspectiveCamera there might be some smaller margins (empty space) on one or the other side of the Viewport3D.
To get the calculated Distance or CameraWidth and new TargetPosition without changing the current camera, you can use the GetFitIntoViewDistanceOrCameraWidth(IListVisual3D, FitIntoViewType, Boolean, Point3D) method.
See Also