Hi.
I have a simple function that rotates a line for example.
Draw a line and angle it at whatever angle, say a 3 inch 45 degree line.
The function will return the angle for rotation that rotates the line until it's at it's thinnest horizontal width.
I use a virtual shape to greatly improve speed.
But...
When I create a virtual shape the angle for the prec (precision value) that I enter cannot seem to be less than .5
For a regular shape, not a virtual shape, I can use any value ie .01
Here's the function. Just pass the shape to it.
Code:
Private Function rotateIt2(s As Shape) As Double
'Dim s As Shape
Dim dup As Shape
Dim thinnestw As Double
Dim angle As Double
Dim rotToThinW As Double, prec As Double
prec = 0.25
'Set dup = s.TreeNode.GetCopy().VirtualShape 'use a virtual shape instead.
Set dup = s.Duplicate
thinnestw = 10000
angle = 0
For angle = 0 To 20 Step prec
dup.Rotate prec
If dup.SizeWidth < thinnestw Then
thinnestw = dup.SizeWidth
rotToThinW = angle
ElseIf dup.SizeWidth > thinnestw And angle <> 0 Then
GoTo exitMe:
End If
Next angle
exitMe:
dup.Delete
rotateIt2 = rotToThinW + prec
End Function
Any ideas?
-John