Click or drag to resize
Ab4d.SharpEngine logo

ModelUtilsGetPositionAndScaleTransform Method

GetPositionAndScaleTransform method returns translation and scale Vector3 so that the sceneNode or mesh with the specified BoundingBox would be positioned according to position and positionType parameters and that it will fit into the size defined by finalSize parameter.

Namespace: Ab4d.SharpEngine.Utilities
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 4.0.9584+ba1aaa26d4181dd3fa8ed7b6398391d1affa36c8
Syntax
C#
public static (Vector3 translateVector, Vector3 scaleVector) GetPositionAndScaleTransform(
	BoundingBox boundingBox,
	Vector3 position,
	PositionTypes positionType,
	Vector3 finalSize,
	bool preserveAspectRatio = true
)

Parameters

boundingBox  BoundingBox
BoundingBox
position  Vector3
Vector3 that specifies position of the sceneNode
positionType  PositionTypes
type of position
finalSize  Vector3
Vector3 that specifies the new size of the sceneNode (if preserveAspectRatio is true, then min scale will be used to fit the model into the size)
preserveAspectRatio  Boolean  (Optional)
if true, then the scale is uniform (using the min required scale to fit the model into finalSize)

Return Value

ValueTupleVector3, Vector3
translateVector and scaleVector as Vector3
See Also