tipforeveryone Posted July 24, 2018 Share Posted July 24, 2018 I am not really good at math, Can you show me how to solve this Known: Position of Red and Blue (in Vec3) Length of edge between Blue and Black, Alpha Angle (in Degree) I want to get the position of Black (in Vec3) Thanks Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted July 24, 2018 Share Posted July 24, 2018 You would use Sin () and Cos () to find the x and y position. Is alpha a constant? Like 90°? Do the red and blue positions vary in the third dimension as well? Or are you looking for the 2D position only of the black? Quote Link to comment Share on other sites More sharing options...
tipforeveryone Posted July 24, 2018 Author Share Posted July 24, 2018 Thanks for you reply All of Red, Blue, Black are in 3D and alpha is not a constant Can you help me with a formula, it is bad that I can't remember these basic formulas for triangle calculation red:GetPosition(true) blue:GetPosition(true) u:Length() alpha black:GetPosition(true) = ??? Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 24, 2018 Share Posted July 24, 2018 Spiderpig is asking about the clarification of angle alpha in relation to what plane it is on. Is that angle value based on an orthographic view (looking down from top) or is the angle along the plane that would exist if the 3 points were on different vertical points in 3D space. Assuming that we are looking at the triangle above in the XZ plane and the Y axis is going into the screen. If its the latter, i don't think we have enough information about what determines the orientation of the plane between the 3 points. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
tipforeveryone Posted July 24, 2018 Author Share Posted July 24, 2018 Here you are Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 24, 2018 Share Posted July 24, 2018 I don't think you have given us enough information to determine how the plane is oriented in 3d space to figure it out. We would need alpha broken down into orthographic components at the very least. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
macklebee Posted July 24, 2018 Share Posted July 24, 2018 Take a look at the picture to see the problem. Think of the line between Red and Blue as a rotating shaft. Think of the green line of known length at known angle as a fixed limb coming off Blue. As the Red/Blue shaft rotates, the Black dot could be anywhere along the red circular path and still hold true to the information that has been provided. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
tipforeveryone Posted July 24, 2018 Author Share Posted July 24, 2018 Oh I see, Thanks for pointing it out. If there is one more vector (a) which have known Orange point position, and it is on the same plane with vector u and w (as figure image), and a new beta angle which = 1/2 * alpha angle will it be posible to calculate the Black position ? Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 24, 2018 Share Posted July 24, 2018 Should be possible as it gives the orientation of the plane. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
tipforeveryone Posted July 24, 2018 Author Share Posted July 24, 2018 Just now, macklebee said: Should be possible as it gives the orientation of the plane. It sound sweet, then please help me with a simple fomula or steps to archive my calculation Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 24, 2018 Share Posted July 24, 2018 Quote It sound sweet, then please help me with a simple fomula or steps to archive my calculation I don't know how simple it will be but I will try tomorrow after work if someone does not help you before then. I needed to go to bed two hours ago. 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Ma-Shell Posted July 24, 2018 Share Posted July 24, 2018 In the following I will use the following terminology: A -> blue point, B -> red point, C -> yellow point, D -> black point (point to find); I will further use o to specify the dot-product of two vectors and use v1, v2, v3 to specify the individual components of v. Overview: You need to mirror B on the line AC. This will yield a point B' which is on the line AD. From there you can calculate D by going |u| from A in the direction of AB'. Step by step: The line going through A and C can be written as X=A+p*a with p being a scalar variable. We need to find a vector Z such that B+Z is on that line (i.e. there exists a value for p such that B+Z = A+p*a -> Z = A+p*a-B -> Z = p*a-w) and that is perpendicular to a (i.e. Z o a = 0). Together that is: 0 = (p*a-w) o v 0 = (p*a1-w1)*a1 + (p*a2-w2)*a2 + (p*a3-w3)*a3 -> p = (a1*w1+a2*w2+a3*w3)/(a1*a1+a2*a2+a3*a3) -> p = (a o w) / |a| With this we can calculate Z as Z = p*a-w Now we can mirror B as B' = B+2*Z -> B' = B+2*(p*a-w) Now we can calculate D as D = A + |u| * (B' - A) / |(B' - A)| Implementation: Simply hack in the formulas I marked as fat and you should be good (p is a float and B' and D are both vectors). Let me know if you need any further help with that! 1 1 Quote Link to comment Share on other sites More sharing options...
macklebee Posted July 30, 2018 Share Posted July 30, 2018 Ma-Shell obviously knows his vector math but like the OP, vector math has always been a struggle for me though I can handle 3D geometry fair enough . I have to break vector math down into steps that I can understand and follow, So even though you have an answer already (but past my ability to follow), I decided to take a crack at this. I used multiple references and I will post them with the steps as this was a fun learning experience for me. So the problem was to find pointD given this information: Given: 3 points given are all on the same plane, points A, B, & C The angle between VectorA-B and VectorA-C is equal to angle between VectorA-B and VectorA-D The distance from point A to point D is known Find: point D Assumptions: The three given points are not collinear to allow for determining the plane equation Due to equal angles between vectors, VectorA-MirroredPoint is the reflected vector of VectorA-C across the mirror plane that is along VectorA-B Solution: To reflect a point across the mirror plane, we must first find the plane that the three given points (A,B, and C) are located. Once we have planeABC, then the mirror plane will be orthogonal to that plane and pass through the line or vector AB. Once the mirror plane is determined, then we can mirror the point. And finally determine the point along the line where the fixed length would occur. 1) Find the plane that contains points A, B, and C. Using the 3 points, you can calculate two vectors: 1a) Find the two vectors given the 3 points - A, B, & C. --Finding a 3D line through 2 points --https://www.youtube.com/watch?v=JlRagTNGBF0 Vab = FindVector( pointA, pointB ) --vector AB Vac = FindVector( pointA, pointC ) --vector AC 1b) Get the normal vector to two vectors. --Equation of a Plane Passing Through 3 Points --https://www.youtube.com/watch?v=0qYJfKG-3l8 normalvector = FindNormalOfTwoVectors( Vab, Vac ) 1c) Get the Plane Equation using the normal vector and a point --Note that you can use any of the 3 points above and get same answer. plane = GetPlaneEquation( normalvector, pointA ) 2) To find orthogonal plane for mirror/reflection, we need two vectors and point on the plane -Just like before! --Find the Equation of Plane Containing a Line and Orhtogonal to a Given Plane --https://www.youtube.com/watch?v=aupy5wwAyb8 2a) The normal of planeABC is a vector on the Mirror plane Vn = FindNormalVectorOfPlane(plane) 2b) We want the mirror/reflection plane to also contain vector AB - which we have already found = Vab. Find the normal vector to the two vectors. Mirror_normalvector = FindNormalOfTwoVectors(Vn, Vab) 2c) Now get the Mirrored Plane's Equation using pointA or pointB and its normal vector Mirror_plane = GetPlaneEquation(Mirror_normalvector, pointA) 3) Now that we have the reflection plane that that runs through line AB, lets mirror pointC about it --Find Mirror Image of a Point Reflected on Vector Plane --https://www.youtube.com/watch?v=fvXG-DVx6z0 pointMP = FindMirroredPoint(Mirror_plane, pointC) 4) Find pointD that is Dist_AD from pointA --Finding a point along a line in 3D given 2 points --Used alternative method shown at bottom of page --https://math.stackexchange.com/questions/83404/finding-a-point-along-a-line-in-three-dimensions-given-two-points pointD = FindPointAlongLine(pointA, pointMP, Dist_AD) Scripts: Vector_Plane_PointReflection_Equations.lua contains the functions shown above Vector_Plane_PointReflection_Equations.lua Main.lua contains the example script that shows how to use the functions Main.lua 1 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
tipforeveryone Posted August 2, 2018 Author Share Posted August 2, 2018 Thanks macklebee, your explaination is clear as daylight ! so detail. Finally I did it, It took time to understand math in English ^^ Quote Link to comment Share on other sites More sharing options...
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.