Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

BoundingBox at angle

14 views
Skip to first unread message

Rob Starz

unread,
Nov 7, 2001, 2:04:30 PM11/7/01
to
I have the boundingbox for an object but I am trying to get the boundingbox
at a specific angle. I thought that rotating the ucs I may get the desired
bounding box but that resulting in the boundingbox at World coordinates.

Does anyone have a way to get a boundingbox of an object but from a
reference angle.

--
|
-+-------------------------------------------------
| Rob Starz
| Stardsign cad solutions
| iC - AEC Information Center
| www.stardsign.com/aecic.html
| free ADT and Building Systems tools
| *******LayerX available Now*************
| www.stardsign.com/layerx.htm
| Easter Egg Hunt.....win a free version of LayerX


Rob Starz

unread,
Nov 7, 2001, 2:56:26 PM11/7/01
to
I am looking into Translatecoordinate. Am I headed in the right direction?

--
|
-+-------------------------------------------------
| Rob Starz
| Stardsign cad solutions
| iC - AEC Information Center
| www.stardsign.com/aecic.html
| free ADT and Building Systems tools
| *******LayerX available Now*************
| www.stardsign.com/layerx.htm
| Easter Egg Hunt.....win a free version of LayerX

"Rob Starz" <r...@stardsignNOSPAM.com> wrote in message
news:660A80C4C50531EF...@in.WebX.maYIadrTaRb...

Rob Starz

unread,
Nov 7, 2001, 11:04:50 PM11/7/01
to
Nope...I am still lost. Any input would be appreciated.

Thanks

Martin Groen

unread,
Nov 8, 2001, 4:34:04 AM11/8/01
to
Perhaps (temporarily)rotating the object gives you the solution?

"Rob Starz" <r...@stardsignNOSPAM.com> wrote in message

news:5671797EB6076389...@in.WebX.maYIadrTaRb...

Rob Starz

unread,
Nov 8, 2001, 9:52:46 AM11/8/01
to
I am working with using VLa-Copy and Rotate. I was just wondering if there
was a way to get this via a translation of points or something.

thanks

R. Robert Bell

unread,
Nov 8, 2001, 10:04:12 AM11/8/01
to
I _believe_ that is the only way. BoundingBox returns the bounds in WCS of
the objects disregarding rotations or UCS's. Then along came "someone who
really knows"...

--
R. Robert Bell, MCSE
http://www.acadx.com


"Rob Starz" <r...@stardsignNOSPAM.com> wrote in message

news:DFD08DEAE0A2AC80...@in.WebX.maYIadrTaRb...

Rob Starz

unread,
Nov 8, 2001, 10:22:28 AM11/8/01
to
Actually I would need to rotate the object the negative value of the roation
angle I want. Then grab the boundingbox. I have that so far....now I am
trying to figure how to translate the poinst I got as compair to the
origianl location.

I hope I am explaining what I am looking for properly. I am no Geometry
whiz...so please forgive me.

Frank Oquendo

unread,
Nov 8, 2001, 10:14:57 AM11/8/01
to
Rotating the object doesn't give you a rotated bounding box, just a
distorted one.

--
http://www.acadx.com

Good judgement comes from experience.
Experience comes from bad judgement.


"Rob Starz" <r...@stardsignNOSPAM.com> wrote in message

news:DFD08DEAE0A2AC80...@in.WebX.maYIadrTaRb...

Frank Oquendo

unread,
Nov 8, 2001, 10:59:08 AM11/8/01
to
Here's an absolute hack:

Draw a rectangle using the bounding box coordiantes of the rotated copy,
then rotate the box back to the original angle.

--
http://www.acadx.com

Good judgement comes from experience.
Experience comes from bad judgement.


"Rob Starz" <r...@stardsignNOSPAM.com> wrote in message

news:BC075D4C94253261...@in.WebX.maYIadrTaRb...

Luis Esquivel

unread,
Nov 8, 2001, 12:57:54 PM11/8/01
to
Rob,

Here is something that might help you (I don't know, I must have something
on this I will search on my functions, not sure)

But in the meantime here is (just excuse my English and bad explanation I
not a good teacher):

To obtain what you are looking for you need to use the coordinates
transformation formula
in example: if you rotate the coordinate axis to a 15 degree angle
counterclockwise your point
(x,y) and the new coordinates

(x', y') according to the rotated axis will be:

x' = x * cos(A) + y * sin(A)
y' = y * cos(A) - x * sin(A)

Now, you need to take the first rotated point as reference to establish the
new
minimum and maximum coordinates and compare with the following points.
If a new point exists with an less x' than the previous point, then that
must be
the new minimum x, the same will be to find ymin', ymax', xmax'.
Right after to compare all the points you will obtain all the coordinates of
the
rectangle (boundingbox) corner rotated (xmin', ymin') and (xmax', ymax').
The four corners coordinates respect to the rotated axis then will be:

(xmin', ymin')
(xmax', ymin')
(xmax', ymax')
(xmin', ymax')

To transform this rotated coordinates respect to the normal coordinate
system
XY you must apply the following formula:

x = x' * cos(A) - y' * sin(A)
y = x' * sin(A) + y' * cos(A)

Rob Starz

unread,
Nov 8, 2001, 1:23:59 PM11/8/01
to
Luis,

This is a lot to ponder. I will print out and read over lunch and see if I
fully understand your procedure. I will need to draw pretty pictures to
understand this I think.

Thanks.

--
|
-+-------------------------------------------------
| Rob Starz
| Stardsign cad solutions
| iC - AEC Information Center
| www.stardsign.com/aecic.html
| free ADT and Building Systems tools
| *******LayerX available Now*************
| www.stardsign.com/layerx.htm
| Easter Egg Hunt.....win a free version of LayerX

"Luis Esquivel" <lu...@slarchitects.com> wrote in message
news:843D3ADDB21A96CD...@in.WebX.maYIadrTaRb...

Luis Esquivel

unread,
Nov 8, 2001, 1:54:40 PM11/8/01
to
Here are some Transformation Routines, that might be useful...

Best regards,
Luis Esquivel

trans routines.lsp

John Uhden

unread,
Nov 8, 2001, 4:21:28 PM11/8/01
to
Luis:

The problem remains that the bounding box retrieves the max/min x and y
based on the object's current orientation. In this crude pictogram, the
bounding box (shown as ......) is not at all the same shape or size as the
object (shown as * * * *) would be if rotated otherwise. As Frank says, I
believe "hacking" is in order.
............................
. * .
. * * .
. * * .
.* *
. * *
. * * .
..................*........

--
John Uhden, Cadlantic/formerly CADvantage
--> mailto:juh...@cadlantic.com
--> http://www.cadlantic.com
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711
FAX 732-528-1332

"Luis Esquivel" <lu...@slarchitects.com> wrote in message
news:843D3ADDB21A96CD...@in.WebX.maYIadrTaRb...

Luis Esquivel

unread,
Nov 8, 2001, 4:34:43 PM11/8/01
to
John

> The problem remains that the bounding box retrieves the max/min x and y
> based on the object's current orientation. In this crude pictogram, the
> bounding box (shown as ......) is not at all the same shape or size as the
> object (shown as * * * *) would be if rotated otherwise. As Frank says, I
> believe "hacking" is in order.
> ............................
> . * .
> . * * .
> . * * .
> .* *
> . * *
> . * * .
> ..................*........

Yes, but what I'm referring in my example formula is to do it without the
getboundingbox method, just by using some math's, I'm still searching for
that piece of code that I wrote some years back, and it does what Rob wants.

Later,
Luis


Bobby C. Jones

unread,
Nov 9, 2001, 9:07:24 AM11/9/01
to
Ok Rob,

Here's my stab. This is overkill for a simple 2d rotation, but it's all
that I've currently got in my library. Feed each point of your boundingbox
to the (TransFormBy) function with the appropriate rotation angle in radians
& the rotation basepoint. The offsetXYZ arg will be '(0 0 0), unless you
want to move the box and the scaleXYZ arg will be '(1 1 1), unless you want
to scale it. Also note that this function is not optimized for speed, it is
optimized for me understanding the math behind the code. This won't matter
when calling it with four points of a bounding box, but if you're
transforming all the vertices of your 55,000 face 3dmesh imortalizing Rocky
& Bullwinkle, then it will matter.

;;;Special thanks to Vladimir Nesterovsky
;;;for these four matrix manipulation routines

;;;a dot product of the two vectors, u & v
(defun dotprod (u v)
(apply '+ (mapcar '* u v))
)

;;;transpose a matrix
;;;code by doug Wilson
(defun transpose (m)
(apply 'mapcar (cons 'list m))
)

;;;Apply a transformation matrix to a vector
(defun mxv (m v)
(mapcar '(lambda (row) (dotprod row v))
m
)
)

;;;Multiply two matrices
(defun mxm (m q)
(setq q (transpose q))
(mapcar '(lambda (row) (mxv q row))
m
)
)


;;;Performs multiple transformations on a point given the Basepoint, Offset,
Scale, and Rotation
;;;This example Rotates the point 5,5,0 90d from the basepoint -1,-1,0
;;;(transformby '(5 5 0) '(-1 -1 0) '(0 0 0) '(1 1 1) (* 0.5 pi))
;;;Returns (-7.0 5.0 0.0)

;;;This example Rotates the point 5,5,0 90d from the basepoint -1,-1,0
;;;AND moves it +10 in the X direction and -6 in the Y direction
;;;(transformby '(5 5 0) '(-1 -1 0) '(10 -6 0) '(1 1 1) (* 0.5 pi))
;;;Returns (3.0 -1.0 0.0)
;;;Bobby C. Jones
(defun TransFormBy (Pnt BasePnt OffsetXYZ scaleXYZ Rot / ScaleX ScaleY
ScaleZ
Tx Ty Tz ScaleM RotateZM MoveM TransM)

(mapcar 'set
'(Scalex ScaleY ScaleZ)
scaleXYZ)
(mapcar 'set
'(Tx Ty Tz)
(mapcar '+ OffsetXYZ BasePnt)
)

(setq scaleM
(list (list ScaleX 0 0 0)
(list 0 ScaleY 0 0)
(list 0 0 ScaleZ 0)
(list 0 0 0 1)
)
RotateZM
(list (list (cos Rot) (- (sin Rot)) 0 0)
(list (sin Rot) (cos rot) 0 0)
(list 0 0 1 0)
(list 0 0 0 1)
)
MoveM
(list (list 1 0 0 Tx)
(list 0 1 0 Ty)
(list 0 0 1 Tz)
(list 0 0 0 1)
)
TransM (mxm MoveM (mxm ScaleM RotateZM))
pnt (mapcar '- pnt BasePnt)
); _end of Setq

(reverse (cdr (reverse (mxv TransM (append pnt '(1))))))
)
--
Bobby C. Jones
http://www.acadx.com

Rob Starz

unread,
Nov 9, 2001, 10:01:23 AM11/9/01
to
I haven't had a chance to try what Luis posted. I will have time today and
I will give your a try. Thanks for everyones input and I hope I understand
it all. I will probably post back here regarding areas I don't understand.

Thanks again.

Matty_Taylor

unread,
Nov 9, 2001, 10:41:25 AM11/9/01
to
I don't know who wrote this, I don't even know if it's relevant for this
thread,
but, hey - I'm posting it anyway !!!
Simple & smart !
Functions described below....

(defun dtr(x) (* x (/ pi 180)))
(defun select(opt / p1 p2 p3 p4 ang code l1)
(setq p1 (getpoint "\nFirst corner: ")
ang (getangle p1 "\nAngle: ")
code 5
)
(prompt "\nOther corner: ")
(while (= code 5)
(setq l1 (grread 1 6 1))
(if (and p2 p4) (grvecs (list 300 p1 p2 p2 p3 p3 p4 p4 p1)))
(setq p3 (cadr l1) code (car l1)
p2 (inters p1 (polar p1 ang 1) p3 (polar p3 (+ ang (dtr 90)) 1) nil)
p4 (inters p1 (polar p1 (+ ang(dtr 90)) 1) p3 (polar p3 (+ ang pi)1)
nil)
)
(grvecs (list 300 p1 p2 p2 p3 p3 p4 p4 p1))
)
(grvecs (list 300 p1 p2 p2 p3 p3 p4 p4 p1))
(eval(ssget opt (list p1 p2 p3 p4)))
)
; FOR ANGULAR WINDOW
(defun aw()(select "wp"))
; FOR ANGULAR CROSSING
(defun ac()(select "cp"))
(prin1)


M@


Bobby C. Jones

unread,
Nov 9, 2001, 2:07:35 PM11/9/01
to
Ok Rob, I was enjoying a nice peaceful lunch looking over some notes and
who's problem pops into my head?? Yes, yours...Not your fault I know, but
I've got my own problems to think about :-) What John says here is true, if
your text is at an angle, then the return from (textbox) will be skewed. To
overcome this, simply modify the rotation assoc code, 50, to zero in the
elist that you feed to (textbox). This will give you the textbox corners of
an un-rotated piece of text. Then build your other two points, and pass
them all to my (transformby) function with the desired rotation and you've
got it!!
0 new messages