From shery202007 at yahoo.com Sun Dec 3 07:43:52 2006 From: shery202007 at yahoo.com (shery anderson) Date: Sat, 2 Dec 2006 22:43:52 -0800 (PST) Subject: [Python.NET] Help please: Convert to Python Message-ID: <639489.20871.qm@web59004.mail.re1.yahoo.com> I have below code that needs to be recoded into Python for use in ESRI ArcGIS software. I would greatly appreciate any assistance. Thanks Sheri /* The Inner Loop of the Douglas-Peucker line generalization algorithm is the process of finding, for a section of a polyline, the vertex that is furthest from the line segment joining the two endpoints. The method coded below in C (or C++) is the most efficient, in terms of operation counts, that I have seen. */ /* _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ */ long FurthestFromSegment ( /* Return index of furthest point. */ long startindex, /* Index of start vertex in arrays. */ long endindex, /* Index of end vertex in arrays. */ double *x , /* Array, abscissae of polyline vertices. */ double *y , /* Array, ordinates of polyline vertices. */ double *distMaxSquare /* Return square of maximum distance. */ ) /* This function, given a section of a polyline in arrays, will return the index of the intermediate node that is furthest from the segment joining the two endpoints of the section, and the square of the distance from the segment. If no intermediate point exists, then the returned index will be the index of the start vertex and the returned distance squared will be -1.0 . Caution: Do not calculate the square root of this returned value without ruling out the possibility that it may have defaulted to -1.0 . In a normal Douglas-Peucker application, you should never have to calculate the square root of this output value, and you should never need to invoke this function without intermediate points. */ { /* The variable names below assume we find the distance of point "A" from segment "BC" . */ long index, outindex ; double distSquare, bcSquare ; double cx, cy, bx, by, ax, ay ; double bcx, bcy, bax, bay, cax, cay ; *distMaxSquare = -1.0 ; if ( endindex < startindex + 2 ) return startindex ; outindex = startindex ; bx = x[startindex] ; by = y[startindex] ; cx = x[endindex] ; cy = y[endindex] ; /* Find vector BC and the Square of its length. */ bcx = cx - bx ; bcy = cy - by ; bcSquare = bcx * bcx + bcy * bcy ; /* The inner loop: */ for ( index = startindex + 1 ; index < endindex ; index++ ) { /* Find vector BA . */ ax = x[index] ; ay = y[index] ; bax = ax - bx ; bay = ay - by ; /* Do scalar product and check sign. */ if ( bcx * bax + bcy * bay <= 0.0 ) { /* Closest point on segment is B; */ /* find its distance (squared) from A . */ distSquare = bax * bax + bay * bay ; } else { /* Find vector CA . */ cax = ax - cx ; cay = ay - cy ; /* Do scalar product and check sign. */ if ( bcx * cax + bcy * cay >= 0.0 ) { /* Closest point on segment is C; */ /* find its distance (squared) from A . */ distSquare = cax * cax + cay * cay ; } else { /* Closest point on segment is between B and C; */ /* Use perpendicular distance formula. */ distSquare = cax * bay - cay * bax ; distSquare = distSquare * distSquare / bcSquare ; /* Note that if bcSquare be zero, the first of the three branches will be selected, so division by zero will not occur here. */ } } if ( distSquare > *distMaxSquare ) { outindex = index ; *distMaxSquare = distSquare ; } } /* Note that in the inner loop above, if we follow the most common path where the perpendicular distance is the one to calculate, then for each intermediate vertex the float operation count is 1 divide, 7 multiplies, 5 subtracts, 1 add, and 2 compares. */ return outindex ; } --------------------------------- Need a quick answer? Get one in minutes from people who know. Ask your question on Yahoo! Answers. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20061202/1787cda5/attachment.html From seshagiri.cherukuri at gmail.com Mon Dec 4 21:50:47 2006 From: seshagiri.cherukuri at gmail.com (Seshagiri Cherukuri) Date: Mon, 4 Dec 2006 12:50:47 -0800 Subject: [Python.NET] .net 2.0 - pythonnet v2.4 does not recognize any of .net 2.0 assemblies Message-ID: <8d12fba0612041250wecd100bi4ecff60e6daff16d@mail.gmail.com> hi All, I have just installed Pythonnet v2.4 and was trying to work with .net 2.0assemblies, it is not able to recognize any of the .net 2.0 assemblies either those in GAC or those not in GAC. Here are the problems I am seeing ( I am running the standalone pythonnet): 1. The readme files at http://pythonnet.sourceforge.net/readme.html mentions that you dont have to use the CLR.System kind of namespace anymore. However if I write something like from System import String There is an error which says "No module named System" 2. When using .net 2.0 assemblies, even the CLR.xxx syntax is not working - there is always an error which says "No module named xxx" 3. Not able to use any of the .net stuff - e.g. from CLR.System.Collections.Generic does not work because it is not able to see the module Generic. Am I doing something wrong? The 2.4 installation was obtained from here ( http://sourceforge.net/project/showfiles.php?group_id=162464). Do I have to get the latest code instead of these installers to be able to use the .net 2.0 and other features? Looking forward to your reply. Seshagiri -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20061204/d36ca74c/attachment.html From TGalvin at geminidataloggers.com Tue Dec 19 15:53:52 2006 From: TGalvin at geminidataloggers.com (Tom Galvin) Date: Tue, 19 Dec 2006 14:53:52 -0000 Subject: [Python.NET] Subset implementation for CompactFramework Message-ID: Hi I am investigating the possibility of upgrading the gui of a pythonce handheld application from mfc to .net. I have started trying to build pythonnet for the Compact Framework. I noticed the posting from July 2005 and wondered if anyone has any experiences they would like to share? Many thanks Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20061219/7184b9d2/attachment.html From brian.lloyd at revolution.com Tue Dec 19 16:17:38 2006 From: brian.lloyd at revolution.com (Brian Lloyd) Date: Tue, 19 Dec 2006 10:17:38 -0500 Subject: [Python.NET] Subset implementation for CompactFramework In-Reply-To: Message-ID: Hi Tom ? last time I looked, key parts of reflection and interop were missing from the CF. Python for .NET relies deeply and heavily on those ;) -Brian On 12/19/06 9:53 AM, "Tom Galvin" wrote: > Hi > > I am investigating the possibility of upgrading the gui of a pythonce handheld > application from mfc to .net. I have started trying to build pythonnet for the > Compact Framework. I noticed the posting from July 2005 and wondered if anyone > has any experiences they would like to share? > > Many thanks > > Tom > > > _________________________________________________ > Python.NET mailing list - PythonDotNet at python.org > http://mail.python.org/mailman/listinfo/pythondotnet -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20061219/4a5fa821/attachment.htm From lab_monkey at mail2world.com Wed Dec 20 02:56:28 2006 From: lab_monkey at mail2world.com (Ior Bock) Date: Tue, 19 Dec 2006 17:56:28 -0800 Subject: [Python.NET] Python - WEIRD Code needed (help with) Message-ID: <42dc01c723da$0fe7a330$0a10010a@mail2world.com> Hi, Looking for help with trying to figure out a way to emulate simple tv video feedback with PYTHON using simple scripts. Am presenting this to students and hope to stimulate their interest in this phenomenon. I've a background in Visual Basic, and am using an old version, 4.0, it compiles to a smaller executable which I prefer. I find myself in an odd situation, needing a very simple yet powerful capability of Python for a VB app Im working on. For this scenario I don't know where to begin though, am hoping for some thoughtful input, suggestions, and code samples to get me started would be a God send. Would prefer NOT using DirectX if possible. I know VERY litle about Python and a fair bit about VB. Have included a bunch of links to illustrate what I am looking for. Really what Im after is best represented in the very first link, and this is what I would like to replicate. Would like to do this with integers being used as the feedback medium, so instead of video signal feedback, we use "number feedback" Imagine in the following brief description we have our numbers acting as the signal in and signal out; "Video Feedback is easy and fun for anyone with a video camera and a monitor (TV screen). To make the simplest kind, take the "video out" from the camera and plug it into the "video in" on the monitor, and then point the camera at the monitor, so the monitor displays a picture of the monitor. Now you have a video feedback loop! To get the effects demonstrated in the gallery, careful adjustments of the various knobs and dials on the camera and monitor are required. I also recommended that you get a tripod. This is especially useful for doing rotations, since the camera can be held at a fixed angle. Adjust the tripod so you can rotate the camera about the viewing axis." Have tried this in Visual Basic, so in the VB code, user inputs numbers into some text boxes and these serve as the "video in" and "video out" mechanisms, so through looped recursion; do while loop_counter <> 5000 textbox1.text = 100 represents Camera video out textbox2.text = 75 represents Monitor video in var = new value + (textbox1.text + textbox2.text) recursion value (code here generates graphic spiral ) loop Would like the feedback generated however to be tied directly to the number inputs specifically though. Cheers ------------------ P.S. - got the following response from a VB forum; "Originally Posted by chemicalNova In any way in VB, drawing the graphical spiral will be very very VERY slow. Does it have to be literally the same as whats above? How about, for example, a PictureBox that acts as the screen (video out), and a PictureBox that acts as the camera (video in). The Screen picturebox has a mini version of the camera box, which holds the contents of the Screen Picturebox. Then, you could possibly give exact rotation angles, for the camera, and display it inside the screen picturebox." -------------- Ideally, I'd love to be able to simply have some extremely small executable that just accepts inputs does the calculations above and then spits out the graphical outputs. If I could simply have my VB app, 'call' the name of the tiny Python executable, and then the Python executable just automatically looked for a named text file (created by the VB app) and extracted number file from this, then performed the calcs, then displayes the feedback emulation that would be ideal! Following demonstrates what Im after exactly, note I'm not looking for a solution that needs to be really high fine complex graphics, etc - just want to demonstrate the basic concept. '====================== DESCRIPTIVE LINKS on VIDEO FEEDBACK FOLLOW; ------------- http://www.youtube.com/watch?v=2Jqm62IhLGM http://www.videofeedback.dk/World/ http://www.archive.org/movies/thumbnails.php?identifier=HansLemursonDavi dSkold http://www.youtube.com/watch?v=RuHmtSGbD8s http://www.youtube.com/watch?v=2Jqm62IhLGM http://www.archive.org/movies/thumbnails.php?identifier=HansLemursonDavi dSkold http://www.youtube.com/watch?v=RuHmtSGbD8s http://www.youtube.com/results?search_type=search_videos&search_query=fe edback&search_sort=&search_category=26 http://members.tripod.com/professor_tom/galleries/video/mixer/mixer4.htm l http://members.tripod.com/professor_tom/galleries/video/mixer/mixer5.htm l http://www.videofeedback.dk/World/ http://nyfilmvideo.com/sep2002/screen4.htm ===== Space-Time Dynamics in Video Feedback James P. Crutchfield Video feedback provides a readily available experimental system to study complex spatial and temporal dynamics. This article outlines the use and modeling of video feedback systems. It http://www.youtube.com/results?search_type=search_videos&search_query=fe edback&search_sort=&search_category=26 MediaSculp - Gallery http://www.mediasculp.com/QTVR/ http://www.mediasculp.com/Gallery/videofeedback/index.htm http://www.videofeedback.dk/vf/oversigt.html http://www.videofeedback.com/ http://www.art.pdx.edu/faculty/facultyhome/pirofsky/digital_stupa/digita lstupa.html Click for free info on online masters degrees and make $150K/ year

_______________________________________________________________
Get the Free email that has everyone talking at http://www.mail2world.com
Unlimited Email Storage – POP3 – Calendar – SMS – Translator – Much More!
-------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/pythondotnet/attachments/20061219/fce506c0/attachment.html