CS1 Posted March 4, 2008 Share Posted March 4, 2008 I have created a basic Worksheet to tell me the lengths of rectangles in a certain class. I have used the Database tool. The Equation line reads =width (in the header of row A) This works fine for rectangles that are not at an angle but if I rotate the rectanlge the "width" is now the X length. In other words if I have a rectangle measuring 1000x50 The result of the equation for Width = 1000 The result of the equation for Height = 50 If I then rotate the rectangle 45? The result of the equation for Width = Height Ive tried using the functions -Length -Width -Height but none seem to tell me the "length of a rectangle that is rotated. What am I doing wrong? Quote Link to comment
CS1 Posted March 4, 2008 Author Share Posted March 4, 2008 I know a quick fix would be to create an equation using Hypotinuse for the width and the angle. But... If I use the function "angle" for a rectangle the result = 0 Quote Link to comment
Gerrit Posted March 5, 2008 Share Posted March 5, 2008 In a worksheet, you can use these formulas to calculate the object's boundary box : =BOTBOUND =TOPBOUND =LEFTBOUND =RIGHTBOUND With a little trigonometry, you may get somewhere. While we're at it, the new rotated rectangle is a new function in VectorScript as well : RectangleN(x,y,cos,sin,height,width); (not sure if I have the parameters right) so maybe there's a way to retrieve that information into a worksheet (although I haven't found that yet). Quote Link to comment
Dieter @ DWorks Posted March 5, 2008 Share Posted March 5, 2008 RectangleN(x,y,cos,sin,width,height); Quote Link to comment
MullinRJ Posted March 5, 2008 Share Posted March 5, 2008 To the best of my knowledge, there are no calls that yield the LxW dimensions for new rotated objects when they are, or the plan is, rotated. I believe this to be true for VS and WkSheets. In VS, it is possible to dissect the objects to get the values, but that is a tedious and error prone task. In WkSheets I think you'll have to wait until the powers-that-be provide for the masses. The new functions let you set, but not retrieve values. Raymond Quote Link to comment
Gerrit Posted March 5, 2008 Share Posted March 5, 2008 A bit too quick on my keyboard there - thanks. Wonder why both cos and sin are needed in there. Quote Link to comment
Dieter @ DWorks Posted March 5, 2008 Share Posted March 5, 2008 Cos and Sin are both needed because they define the direction of the first segment of the rectangle. With only a Cos, for example 0.5, you'll get two directions: 60? and -60?(300?). That's why the Sin is needed. BUT: those two parameters are not the Sin and Cos. They are real values that defines the direction vector. the first is it's x component and the second is it's y component. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.