473,805 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Transforming the Point using list

440 Contributor
Hi,

I have a Point and Transfoirmation matrix.How to translate the Point from one Coordinate system to other using list .

Point1 = [1,2,3]

#Transformation Matrix
T =
[ [1,0,0],
[0,1,0],
[0,0,1]]

I have to get the

TransPoint = Point1 * T

Other than list,is there any other approach is possible to get the transformation of point

Thanks
PSB
Jun 6 '07 #1
5 1822
bvdet
2,851 Recognized Expert Moderator Specialist
Hi,

I have a Point and Transfoirmation matrix.How to translate the Point from one Coordinate system to other using list .

Point1 = [1,2,3]

#Transformation Matrix
T =
[ [1,0,0],
[0,1,0],
[0,0,1]]

I have to get the

TransPoint = Point1 * T

Other than list,is there any other approach is possible to get the transformation of point

Thanks
PSB
The transformation matrix you have defined (T) is the standard orthonormal basis for R3. What is the basis for Point 1? Given an orthonormal basis in R3, a point relative to that basis can be translated to the standard basis :
Expand|Select|Wrap|Line Numbers
  1. from macrolib.PointPlane3D import Point
  2.  
  3. def determinant3(a,b,c,m,n,k,u,v,w):
  4.         return a*n*w + b*k*u + m*v*c - c*n*u - b*m*w - a*k*v
  5.  
  6. def translate(A, B, N, pt):
  7.  
  8.     X,Y,Z = tuple(pt)    
  9.  
  10.     '''
  11.     Normalize pt
  12.     '''
  13.     M = (X*X + Y*Y + Z*Z)**0.5
  14.     try:
  15.         X1, Y1, Z1 = X/M, Y/M, Z/M
  16.     except:
  17.         X1, Y1, Z1 = 0.0, 0.0, 0.0
  18.  
  19.     D = determinant3(A.x, A.y, A.z, N.x, N.y, N.z, B.x, B.y, B.z)
  20.     Dx = determinant3(X1, A.y, A.z, Z1, N.y, N.z, Y1, B.y, B.z)
  21.     Dy = determinant3(A.x, X1, A.z, N.x, Z1, N.z, B.x, Y1, B.z)
  22.     Dz = determinant3(A.x, A.y, X1, N.x, N.y, Z1, B.x, B.y, Y1)
  23.  
  24.     '''        
  25.     Calculate the resultant unit vector 'R1'
  26.     '''
  27.     R1 = Point(Dx/D, Dy/D, Dz/D)
  28.  
  29.     '''
  30.     Return the global coordinate vector
  31.     '''
  32.     return R1*M
  33.  
  34. # local basis 'X'
  35. a = Point(0.462352, 0.850215, 0.251725)
  36. # local basis 'Y'
  37. b = Point(0.791086, -0.267295, -0.550215)
  38. # local basis 'Z'
  39. n = Point(-0.400516, 0.453529, -0.796177)
  40.  
  41. print repr(translate(a, b, n, Point(12,12,12)))
  42.  
  43. '''
  44. >>> Point(10.235071, 12.437392, -13.136013)
  45. '''
Please, check my math!

Given three non-collinear points in R3, you can define an orthonormal basis. Let's say point1 is the basis origin, point2 defines the X axis with respect to the origin, and point 3, in combination with p1 and p2, defines the plane:
Expand|Select|Wrap|Line Numbers
  1. >>> c.p1
  2. Point(144.000000, 256.000000, 300.000000)
  3. >>> c.p2
  4. Point(324.000000, 587.000000, 398.000000)
  5. >>> c.p3
  6. Point(645.000000, 400.000000, 130.000000)
  7. >>> a = BasisTransToGlobal(c.p1, c.p2, c.p3, Point(12,12,12))
  8. >>> a.R
  9. Point(154.235075, 268.437392, 286.863999)
  10. >>> a.R-c.p1
  11. Point(10.235075, 12.437392, -13.136001)
  12. >>> 
BTW - This should have been posted to Python Forum instead of Python Articles.
Jun 6 '07 #2
bartonc
6,596 Recognized Expert Expert
Moved from Python Articles

Please be careful not to post questions in the Articles section.

Thanks you for your co-operation in this matter.
Jun 7 '07 #3
Motoma
3,237 Recognized Expert Specialist
Jinkies bvdet! That was amazing!
Jun 7 '07 #4
bvdet
2,851 Recognized Expert Moderator Specialist
Jinkies bvdet! That was amazing!
Nuthin' to it Motoma. I've been working on this module for about a year (in my spare time of course).
Jun 8 '07 #5
bvdet
2,851 Recognized Expert Moderator Specialist
Here's the return trip:
Expand|Select|Wrap|Line Numbers
  1. def transToLocal(pt, m):
  2.     '''
  3.     pt - point object in the standard R3 orthonormal basis
  4.     vA - local 'X' unit vector
  5.     vB - local 'Y' unit vector
  6.     vN - local 'Z' unit vector
  7.  
  8.     'dot()' is a Point object method that returns the dot product    
  9.  
  10.     Return the local coordinate
  11.     Vector projection of: pt along vA, pt along vB, pt along vN
  12.     '''
  13.     return Point(pt.dot(Point(*m[0])), \
  14.                  pt.dot(Point(*m[1])), \
  15.                  pt.dot(Point(*m[2])))
  16.  
  17. # Local basis translation matrix
  18. m = [(0.462352, 0.850215, 0.251725), \
  19.      (0.791086, -0.267295, -0.550215), \
  20.      (-0.400516, 0.453529, -0.796177)]
  21. # Point object in standard orthonormal basis
  22. pt = Point(10.235071, 12.437392, -13.136013)
  23.  
  24. print repr(transToLocal(pt, m))
  25. # Point(12.000000, 12.000000, 12.000000)
Jun 8 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

34
3300
by: jblazi | last post by:
Let us assume I have a list like and would like to transoform it into the string '{1,2},{7,8},{12,13}' Which is the simplest way of achiebing this? (The list is in fact much longer and I may have to cut the resulting strings into chunks of 100 or
0
4129
by: David Furey | last post by:
Hi, I am using the XSLT document to filter records from an XML document The XSL is shown below: I have a parameter named "search-for" that is used to bring back a list of Vendor Names that start with this parameter. The list works as I want for alpabetical letters. Setting the parameter to 'a' brings back a list of vendors beginning
5
2180
by: Jody Greening | last post by:
Transforming with XSLT, Grouping elements until difference found. I am seeking some help with the following problem, I am fairly new at XSLT transformations, and my problem may lie in looking at it from a traditional programming point of view. I have did quite a bit of searching but have found no answers to my particular problem... please read below XML for the problem I am having.
4
1935
by: Showjumper | last post by:
I am using the NITF DTD for my xml files and i need to use 2 xsl files to do the transform: one for the <body.head> and the second for the <body.content>. I've got this so far for transforming using 1 xsl file: Dim doc As New XmlDocument doc.LoadXml(xmlText) Dim xslDoc As New XslTransform xslDoc.Load(xslpath) Dim sw As New StringWriter xslDoc.Transform(doc, Nothing, sw, Nothing)
3
4879
by: Sergio Otoya | last post by:
Hi all, I need to transform an xml document, using xsl to a HTML output. I can do this successfully using the XslTransform class as below: Dim oTrans As New XslTransform oTrans.Load(sXSLPath) oTrans.Transform(sXMLPath, "c:\trans.htm")
4
2029
by: Cathie | last post by:
Hi All, I am trying to get my style sheet to work. It works fine in IE but I can't get it to work in .net. Below is the function I use for transforming, where advancedOptionsFile is the path to the file containing an XML document required by the transformation, and xmlSimplified is the XML document to trasform. ---------------------------------------------------------------------------- -------------------------------
6
4676
by: Adam Clauss | last post by:
I have a list of points (their coming in as decimal types, I can convert to PointF) that I am trying to draw to a form. Unfortunately, the coordinate system these points are coming from is not like Windows Forms use. Instead of (0,0) being the top left, (0,0) is in the "standard" graph position in the center of the coordinate plane. (So we have positive and negative values on both the x- and y- axis). Is there a "good" way to convert...
1
1171
by: VINITAG | last post by:
<LineItem>pediatric information <NumberedList> <NumberedListItem>dgc</NumberedListItem> <NumberedListItem>djb</NumberedListItem> <NumberedListItem>jbv</NumberedListItem> <NumberedListItem>fnjfvh</NumberedListItem> </NumberedList> </LineItem> <LineItem>Adult...
5
1278
by: james_027 | last post by:
hi, i have a list from a resultset like this 1,"Chicago Bulls",,,"" 2,"Cleveland Caveliers",,,"" 4,"Detroit Pistons",1,"23686386.35" 4,"Detroit Pistons",2,"21773898.07" 4,"Detroit Pistons",3,"12815215.57" 4,"Detroit Pistons",4,"48522347.76" 4,"Detroit Pistons",5,"28128425.99"
0
10359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10104
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7645
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5541
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4317
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3843
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.