+swambast Posted August 26, 2009 Posted August 26, 2009 Alright guys, I'm sorry I've just never been good with math/geometry and my regular knowledgeable resource experts are unavailable right now, so I'm turning to the community for help with some calculations/formulas. I'm trying to determine a formula (based off Pythagorean's Theorem) for calculating displaced center-point object offsets. For example: Inputs: X Offset and Y Offset Coordinates (example: 0,0) X Offset and Y Offset Distance (example: 38,0) means target center actually sits 38M to the East/Right wherever placed, and therefore has a displaced center-point offset of x=38 Target Width (example: 10) Target Height (example: 25) Output Returns: X1/Y1 = 33.00,12.50 X2/Y2 = 43.00,12.50 X3/Y3 = 43.00,-12.50 X4/Y4 = 33.00,-12.50 This is an easy example! Where things get complicated is when the target object has BOTH an X and Y Offset Value. If anyone has strong mathematical and geometry skills and would be willing to help, please send me a Private Message. Thanks for reading. Thanks much, Swambast Quote
+swambast Posted August 27, 2009 Author Posted August 27, 2009 Hi ya, need help figuring out what the end values would be a target offset by both the x/y axis so it properly calcs X1/Y1, X2/Y2, X3/Y3 and X4/Y4. And, I believe the first known variable you would have to determine is what the offset value would be using a point of reference (say placing an object in a 0,0 centerpoint using a 50x50 meter dimension)... Quote
bwild Posted August 27, 2009 Posted August 27, 2009 Using your definitions, x_0,y_0 = offset coordinates x_off,y_off = offset distance w = target width h = target heigth then X1/Y1 = (x_0+x_off-.5*w),(y_0+y_off+.5*h) X2/Y2 = (x_0+x_off+.5*w),(y_0+y_off+.5*h) X3/Y3 = (x_0+x_off+.5*w),(y_0+y_off-.5*h) X4/Y4 = (x_0+x_off-.5*w),(y_0+y_off-.5*h) Filling in your example, x_0,y_0 = 0,0 x_off,y_off = 38,0 w = 10 h = 25 then X1/Y1 = (0+38-.5*10),(0+0+.5*25)=33,12.5 X2/Y2 = (0+38+.5*10),(0+0+.5*25)=43,12.5 X3/Y3 = (0+38+.5*10),(0+0-.5*25)=43,-12.5 X4/Y4 = (0+38-.5*10),(0+0-.5*25)=33,-12.5 Now including an y offset distance, x_0,y_0 = 0,0 x_off,y_off = 38,45 w = 10 h = 25 then X1/Y1 = (0+38-.5*10),(0+45+.5*25)=33,57.5 X2/Y2 = (0+38+.5*10),(0+45+.5*25)=43,57.5 X3/Y3 = (0+38+.5*10),(0+45-.5*25)=43,-32.5 X4/Y4 = (0+38-.5*10),(0+45-.5*25)=33,-32.5 Hope this helps. Quote
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.