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
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 : - from macrolib.PointPlane3D import Point
-
-
def determinant3(a,b,c,m,n,k,u,v,w):
-
return a*n*w + b*k*u + m*v*c - c*n*u - b*m*w - a*k*v
-
-
def translate(A, B, N, pt):
-
-
X,Y,Z = tuple(pt)
-
-
'''
-
Normalize pt
-
'''
-
M = (X*X + Y*Y + Z*Z)**0.5
-
try:
-
X1, Y1, Z1 = X/M, Y/M, Z/M
-
except:
-
X1, Y1, Z1 = 0.0, 0.0, 0.0
-
-
D = determinant3(A.x, A.y, A.z, N.x, N.y, N.z, B.x, B.y, B.z)
-
Dx = determinant3(X1, A.y, A.z, Z1, N.y, N.z, Y1, B.y, B.z)
-
Dy = determinant3(A.x, X1, A.z, N.x, Z1, N.z, B.x, Y1, B.z)
-
Dz = determinant3(A.x, A.y, X1, N.x, N.y, Z1, B.x, B.y, Y1)
-
-
'''
-
Calculate the resultant unit vector 'R1'
-
'''
-
R1 = Point(Dx/D, Dy/D, Dz/D)
-
-
'''
-
Return the global coordinate vector
-
'''
-
return R1*M
-
-
# local basis 'X'
-
a = Point(0.462352, 0.850215, 0.251725)
-
# local basis 'Y'
-
b = Point(0.791086, -0.267295, -0.550215)
-
# local basis 'Z'
-
n = Point(-0.400516, 0.453529, -0.796177)
-
-
print repr(translate(a, b, n, Point(12,12,12)))
-
-
'''
-
>>> Point(10.235071, 12.437392, -13.136013)
-
'''
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: - >>> c.p1
-
Point(144.000000, 256.000000, 300.000000)
-
>>> c.p2
-
Point(324.000000, 587.000000, 398.000000)
-
>>> c.p3
-
Point(645.000000, 400.000000, 130.000000)
-
>>> a = BasisTransToGlobal(c.p1, c.p2, c.p3, Point(12,12,12))
-
>>> a.R
-
Point(154.235075, 268.437392, 286.863999)
-
>>> a.R-c.p1
-
Point(10.235075, 12.437392, -13.136001)
-
>>>
BTW - This should have been posted to Python Forum instead of Python Articles.
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.
Motoma 3,237
Recognized Expert Specialist
Jinkies bvdet! That was amazing!
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).
bvdet 2,851
Recognized Expert Moderator Specialist
Here's the return trip: - def transToLocal(pt, m):
-
'''
-
pt - point object in the standard R3 orthonormal basis
-
vA - local 'X' unit vector
-
vB - local 'Y' unit vector
-
vN - local 'Z' unit vector
-
-
'dot()' is a Point object method that returns the dot product
-
-
Return the local coordinate
-
Vector projection of: pt along vA, pt along vB, pt along vN
-
'''
-
return Point(pt.dot(Point(*m[0])), \
-
pt.dot(Point(*m[1])), \
-
pt.dot(Point(*m[2])))
-
-
# Local basis translation matrix
-
m = [(0.462352, 0.850215, 0.251725), \
-
(0.791086, -0.267295, -0.550215), \
-
(-0.400516, 0.453529, -0.796177)]
-
# Point object in standard orthonormal basis
-
pt = Point(10.235071, 12.437392, -13.136013)
-
-
print repr(transToLocal(pt, m))
-
# Point(12.000000, 12.000000, 12.000000)
Sign in to post your reply or Sign up for a free account.
Similar topics |
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
|
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
|
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.
|
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)
|
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")
| |
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.
----------------------------------------------------------------------------
-------------------------------
|
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...
|
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...
|
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"
|
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...
|
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...
| |
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...
|
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...
|
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();...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |