I've been having a lot of trouble with this math problem, and I've tried to solve it for many hours without success.
Here's an example of the problem:
Basically what I need is an algorithm which calculates the Z height at any given 2D coordinate in a rectangle where each corner height can posses any positive value.
If anyone could provide me with an algorithm, that'd be great. I really need it for the map I'm working on.
It doesn't have to be written in galaxy script (though that'd save me some time), I can implement it myself.
I think you didn't quite understand what I tried to say: There is no shape which can be perfectly strained between your 4 corners. You would either need to fix your 4 heights in a way that the 4 heights always result in a beautiful rectangle or you need to calculate with 2 triangles. E.g. the two triangles h1,h3,h4 and h1,h2,h4 create a shape, which defines 1 Z for every possible point on the rectangle below them.
I think you didn't quite understand what I tried to say: There is no shape which can be perfectly strained between your 4 corners. You would either need to fix your 4 heights in a way that the 4 heights always result in a beautiful rectangle or you need to calculate with 2 triangles. E.g. the two triangles h1,h3,h4 and h1,h2,h4 create a shape, which defines 1 Z for every possible point on the rectangle below them.
And that's what I need help with then.
I am aware that it would create two triangles on the top surface, but I have no idea what I would do with those two triangles, which is why I'm asking for an algorithm which allows me to solve the issue.
How did you get that equation? I need it in a form where I can input the various heights and bottom surface height/width into the equation.
The equation you provided would only work with the example.
How did you get that equation? I need it in a form where I can input the various heights and bottom surface height/width into the equation.
The equation you provided would only work with the example.
Sorry, I though you only needed an equasion for the specific values.
That is basically the coordinate formula of the plane created by your data points, calculated from the normal equation of the plane. I took your (0,0,0.5) point as base vector and calculated the normal vector of the plane via vector product of the vectors from the base vector to the 2 adjacent points of the quad.
For your variables, this would look like this. All of these are vectors, x = (x,y,z) being the point you are checking, h1-3 = (h1x, h1y.... are your corner points (You only need 3 of them to define the plane). Capital X is the vector product, not a variable.
(h1-x) * [ (h2-h1) X (h3-h1) ]=0
I assume, you know how to calculate a vector product? All you need to do from here is add all the values, expand and bring z to one side.
There is probably a more code-friendly way to do this, its more of a pen&paper approach, I guess :)
Sorry, I though you only needed an equasion for the specific values.
That is basically the coordinate formula of the plane created by your data points, calculated from the normal equation of the plane. I took your (0,0,0.5) point as base vector and calculated the normal vector of the plane via vector product of the vectors from the base vector to the 2 adjacent points of the quad.
For your variables, this would look like this. All of these are vectors, x = (x,y,z) being the point you are checking, h1-3 = (h1x, h1y.... are your corner points (You only need 3 of them). Capital X is the vector product, not a variable.
(h1-x) * [ (h2-h1) X (h3-h1) ]=0
I assume, you know how to calculate a vector product? All you need to do from here is add all the values, expand and bring z to one side.
Honestly, I started working with vectors for the first time just the other day. Apparantly they don't teach us about vectors during gymnasium, since I'm doing the last math course right now, which is about entirely different things.
Everything I know about it is stuff that I've looked up the last few days.
I'll try to solve it from here. The help you've provided is more than what I managed to get in the last 2 days of asking around.
d = a - b = (d1,d2,d3) = (a1-b1,a2-b2,a3-b3)
e = a - c
You can replace the d and e values in the formula, or you can set up some variables for it. Your choice :)
Also, for your sake I hope you are using galaxy script. Clicking this monster together in Gui will be a pain :)
d = a - b = (d1,d2,d3) = (a1-b1,a2-b2,a3-b3)
e = a - c
You can replace the d and e values in the formula, or you can set up some variables for it. Your choice :)
Also, for your sake I hope you are using galaxy script. Clicking this monster together in Gui will be a pain :)
Yes! Finally managed to set it up.
Z = ((a1-x)((a2-b2)(a3-c3)-(a3-b3)(a2-c2))+(a2-y)((a3-b3)(a1-c1)-(a1-b1)(a3-c3))+a3((a1-b1)(a2-c2)-(a2-b2)(a3-c3)))/((a1-b1)(a2-c2)-(a2-b2)(a1-c1))
I'll just have to replace these with variables and it's ready to be used! :)
As Kueken said. Don't use the GUI editor. You could do the following in the amount of time it would take to make that in the GUI editor:
Learn all of Galaxy (if you haven't already)
Teach a turtle to read
Teach that turtle how to teach other turtles to read
Teach a turtle to speak
Teach that turtle how to teach other turtles to speak
Start a charity in which you send turtles to read moral-boosting books to hospitilized children
Potentially find Atlantis
Your choice.
I do use custom scripts for most of the maps math calculations and actor message related things. I haven't bothered learning all the functions though, so I usually just click my way through other things.
Teach a turtle to read
Teach that turtle how to teach other turtles to read
Teach a turtle to speak
Teach that turtle how to teach other turtles to speak
Don't forget to teach a rat to teach turtles how to fight.
I've been having a lot of trouble with this math problem, and I've tried to solve it for many hours without success.
Here's an example of the problem:
Basically what I need is an algorithm which calculates the Z height at any given 2D coordinate in a rectangle where each corner height can posses any positive value.
If anyone could provide me with an algorithm, that'd be great. I really need it for the map I'm working on.
It doesn't have to be written in galaxy script (though that'd save me some time), I can implement it myself.
Well... it's no rectangle if every corner can have any random value. You rather get two triangles.
@Oelfrachter: Go
When I said rectangle, I was refering to the bottom of the shape, to make it clear that the bottom always will be in the shape of a rectangle.
I think you didn't quite understand what I tried to say: There is no shape which can be perfectly strained between your 4 corners. You would either need to fix your 4 heights in a way that the 4 heights always result in a beautiful rectangle or you need to calculate with 2 triangles. E.g. the two triangles h1,h3,h4 and h1,h2,h4 create a shape, which defines 1 Z for every possible point on the rectangle below them.
z = -0.125*x + 0.5*y + 0.5
And that's what I need help with then.
I am aware that it would create two triangles on the top surface, but I have no idea what I would do with those two triangles, which is why I'm asking for an algorithm which allows me to solve the issue.
How did you get that equation? I need it in a form where I can input the various heights and bottom surface height/width into the equation.
The equation you provided would only work with the example.
Sorry, I though you only needed an equasion for the specific values.
That is basically the coordinate formula of the plane created by your data points, calculated from the normal equation of the plane. I took your (0,0,0.5) point as base vector and calculated the normal vector of the plane via vector product of the vectors from the base vector to the 2 adjacent points of the quad.
For your variables, this would look like this. All of these are vectors, x = (x,y,z) being the point you are checking, h1-3 = (h1x, h1y.... are your corner points (You only need 3 of them to define the plane). Capital X is the vector product, not a variable.
(h1-x) * [ (h2-h1) X (h3-h1) ]=0
I assume, you know how to calculate a vector product? All you need to do from here is add all the values, expand and bring z to one side.
There is probably a more code-friendly way to do this, its more of a pen&paper approach, I guess :)
Honestly, I started working with vectors for the first time just the other day. Apparantly they don't teach us about vectors during gymnasium, since I'm doing the last math course right now, which is about entirely different things.
Everything I know about it is stuff that I've looked up the last few days.
I'll try to solve it from here. The help you've provided is more than what I managed to get in the last 2 days of asking around.
a = (a1,a2,a3), b and c are your 3 corner points.
d = a - b = (d1,d2,d3) = (a1-b1,a2-b2,a3-b3)
e = a - c
You can replace the d and e values in the formula, or you can set up some variables for it. Your choice :)
Also, for your sake I hope you are using galaxy script. Clicking this monster together in Gui will be a pain :)
Yes! Finally managed to set it up.
Z = ((a1-x)((a2-b2)(a3-c3)-(a3-b3)(a2-c2))+(a2-y)((a3-b3)(a1-c1)-(a1-b1)(a3-c3))+a3((a1-b1)(a2-c2)-(a2-b2)(a3-c3)))/((a1-b1)(a2-c2)-(a2-b2)(a1-c1))
I'll just have to replace these with variables and it's ready to be used! :)
Thanks for all the help, I really appreciate it.
As Kueken said. Don't use the GUI editor. You could do the following in the amount of time it would take to make that in the GUI editor:
Your choice.
Great to be back and part of the community again!
I do use custom scripts for most of the maps math calculations and actor message related things. I haven't bothered learning all the functions though, so I usually just click my way through other things.
Don't forget to teach a rat to teach turtles how to fight.