From: <jpi...@us...> - 2011-09-26 21:01:33
|
Revision: 8606 http://octave.svn.sourceforge.net/octave/?rev=8606&view=rev Author: jpicarbajal Date: 2011-09-26 21:01:25 +0000 (Mon, 26 Sep 2011) Log Message: ----------- First set of functions Added Paths: ----------- trunk/octave-forge/main/geometry/COPYING trunk/octave-forge/main/geometry/DESCRIPTION trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/inst/ trunk/octave-forge/main/geometry/inst/data2geo.m trunk/octave-forge/main/geometry/inst/private/ trunk/octave-forge/main/geometry/inst/private/SVGstrPath2SVGpath.m trunk/octave-forge/main/geometry/inst/private/formatSVGstr.m trunk/octave-forge/main/geometry/inst/private/getSVGdata.m trunk/octave-forge/main/geometry/inst/private/getSVGstrPath.m trunk/octave-forge/main/geometry/inst/private/lineGeo.m trunk/octave-forge/main/geometry/inst/private/lineLoopGeo.m trunk/octave-forge/main/geometry/inst/private/planeSurfGeo.m trunk/octave-forge/main/geometry/inst/private/pointGeo.m trunk/octave-forge/main/geometry/inst/private/ruledSurfGeo.m trunk/octave-forge/main/geometry/inst/svgload.m trunk/octave-forge/main/geometry/inst/svgnormalize.m trunk/octave-forge/main/geometry/inst/svgpath2polygon.m Added: trunk/octave-forge/main/geometry/COPYING =================================================================== --- trunk/octave-forge/main/geometry/COPYING (rev 0) +++ trunk/octave-forge/main/geometry/COPYING 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. Added: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION (rev 0) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,11 @@ +Name: Geometry +Version: 1.0.0 +Date: Thursday, September 22 2011 +Author: David Legland <dav...@gr...>, Juan Pablo Carbajal <car...@if...> +Maintainer: Juan Pablo Carbajal <car...@if...> +Title: Computational Geometry +Description: Library for geometric computing extending MatGeom functions. Useful to create, transform, manipulate and display geometric primitives. +Depends: octave (>= 3.4.0) +Autoload: no +License: GPL version 3 or later +Url: http://octave.sf.net, http://matgeom.sf.net Added: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX (rev 0) +++ trunk/octave-forge/main/geometry/INDEX 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,15 @@ +geometry >> Computational Geometry +Input + svgload + svgnormalize + svgpath2polygon +Output + data2geo +2D Geometry + +3D Geometry + +Graphs + + + Added: trunk/octave-forge/main/geometry/inst/data2geo.m =================================================================== --- trunk/octave-forge/main/geometry/inst/data2geo.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/data2geo.m 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,84 @@ +%% Copyright (c) 2010 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} @var{fileStr} = data2geo (@var{data}, @var{lc},@{opt}) +%% Takes data assuming certain order and builds a .geo file compatible with gmsh. +%% +%% @end deftypefn + +function strFile = data2geo(data,lc,varargin) + + nl = @()sprintf('\n'); + + %% Parse options + filegiven = []; + spherical = []; + if nargin > 2 + filegiven = find(cellfun(@(x)strcmpi(x,'output'),varargin)); + spherical = find(cellfun(@(x)strcmpi(x,'spherical'),varargin)); + end + + [n dim] = size(data); + if dim == 2 + data(:,3) = zeros(n,1); + end + + header = ' // File created with Octave'; + strFile = []; + strFile = [strFile header nl()]; + + % Points + strFile = [strFile '// Points' nl()]; + + for i=1:n + strFile = [strFile pointGeo(i,data(i,:),lc)]; + end + + % Lines + strFile = [strFile '// Lines' nl()]; + for i=1:n-1 + strFile = [strFile lineGeo(i,i,i+1)]; + end + strFile = [strFile lineGeo(n,n,1)]; + + % Loop + strFile = [strFile lineLoopGeo(n+1,n,1:n)]; + + % Surface + if spherical + sphr = varargin{spherical+1}; + if dim ==2 + sphr(1,3) = 0; + end + strFile = [strFile pointGeo(n+1,sphr,lc)]; + strFile = [strFile ruledSurfGeo(n+3,1,n+1,n+1)]; + else + strFile = [strFile planeSurfGeo(n+2,1,n+1)]; + end + + if filegiven + outfile = varargin{filegiven+1}; + fid = fopen(outfile,'w'); + fprintf(fid,'%s',strFile); + fclose(fid); + disp(['DATA2GEO: Geometry file saved to ' outfile]) + end +end + +%!demo +%! points = [0 0 0; 0.1 0 0; 0.1 .3 0; 0 0.3 0]; +%! strFile = data2geo(points,0.009); +%! disp(strFile) Added: trunk/octave-forge/main/geometry/inst/private/SVGstrPath2SVGpath.m =================================================================== --- trunk/octave-forge/main/geometry/inst/private/SVGstrPath2SVGpath.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/private/SVGstrPath2SVGpath.m 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,103 @@ +%% Copyright (c) 2011 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +function SVGpath = SVGstrPath2SVGpath (SVGstrPath) + + nPaths = numel (SVGstrPath); + SVGpath = repmat (struct('coord', [], 'closed', [], 'id', []), 1, nPaths); + + for ip = 1:nPaths + path = SVGstrPath{ip}; + + % Match data + [s e te m] = regexpi (path, 'd="(?:(?!").)*'); + data=strtrim (m{1}); + % parse data + d = parsePathData (data); + SVGpath(ip).coord = d.coord; + SVGpath(ip).closed = d.closed; + + % Match id + [s e te m] = regexp (path, 'id="(?:(?!").)*'); + if ~isempty (m) + SVGpath(ip).id = strtrim (m{1}(5:end)); + end + end + +end + +function d = parsePathData (data) + + d = struct ('coord', [], 'closed', []); + + [s e te comm] = regexp (data, '[MmLlHhVvCcSsQqTtAaZz]{1}'); + % TODO + % This info could be used to preallocate d + [zcomm zpos] = ismember ({'Z','z'}, comm); + + if any (zcomm) + d.closed = true; + else + d.closed = false; + s(end+1) = length (data); + end + comm(zpos(zcomm)) = []; + ncomm = size (comm, 2); + for ic = 1:ncomm + + switch comm{ic} + case {'M','L'} + [x y] = strread (data(s(ic) + 1 : s(ic + 1) - 1), ... + '%f%f', 'delimiter', ', '); + coord = [x y]; + + case 'm' + [x y] = strread( data(s(ic) + 1 : s(ic + 1) - 1), ... + '%f%f', 'delimiter', ', '); + nc = size (x, 1); + coord = [x y]; + if ic == 1 + % relative moveto at begining of data. + % First coordinates are absolute, the rest are relative. + coord = cumsum (coord); + else + % Relative moveto. + % The coordinates are relative to the last one loaded + coord(1,:) =coord(1,:) + d.coord(end,:); + coord = cumsum(coord); + warning('svg2octWarning',['Relative moveto in path data.'... + ' May mean that the orginal path was not a simple polygon.' ... + ' If that is the case, the path will not display equally.']) + end + + case 'l' + % Relative lineto, coordinates are relative to last point loaded. + [x y] = strread( data(s(ic) + 1 : s(ic + 1) - 1), ... + '%f%f', 'delimiter', ', '); + nc = size (x, 1); + coord = [x y] + coord(1,:) =coord(1,:) + d.coord(end,:); + coord = cumsum(coord); + + otherwise + warning('svg2oct:Warning',... + 'Path data command "%s" not implemented yet.',comm{ic}); + end + + nc = size(coord,1); + d.coord(end+1:end+nc,:) = coord; + + end +end Added: trunk/octave-forge/main/geometry/inst/private/formatSVGstr.m =================================================================== --- trunk/octave-forge/main/geometry/inst/private/formatSVGstr.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/private/formatSVGstr.m 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,24 @@ +%% Copyright (c) 2011 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +function svgF = formatSVGstr(svg) + + % Remove all newlines and tabs + svgF = strrep(svg,"\n",' '); + svgF = strrep(svgF,"\t",' '); + % Remove consecutive blanks + svgF = regexprep(svgF,' +',' '); + +end Added: trunk/octave-forge/main/geometry/inst/private/getSVGdata.m =================================================================== --- trunk/octave-forge/main/geometry/inst/private/getSVGdata.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/private/getSVGdata.m 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,33 @@ +%% Copyright (c) 2011 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +function svgData = getSVGdata(svg) + + svgData = struct('height',[],'width',[]); + attr = fieldnames(svgData); + nattr = numel(attr); + + [s e te data] = regexpi(svg,'<[ ]*svg(?:(?!>).)*>'); + data=strtrim(data{1}); + + for a = 1:nattr + pattr =sprintf('%s="(?:(?!").)*',attr{a}); + [s e te m] = regexpi(data,pattr); + m=strtrim(m{1}); + [dummy value] = strread(m,'%s%f','delimiter','"'); + svgData.(attr{a}) = value; + end + +end Added: trunk/octave-forge/main/geometry/inst/private/getSVGstrPath.m =================================================================== --- trunk/octave-forge/main/geometry/inst/private/getSVGstrPath.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/private/getSVGstrPath.m 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,20 @@ +%% Copyright (c) 2011 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +function strPath = getSVGstrPath(svg) + + [s e te strPath] = regexpi(svg,'<[ ]*path(?:(?!/>).)*/>'); + +end Added: trunk/octave-forge/main/geometry/inst/private/lineGeo.m =================================================================== --- trunk/octave-forge/main/geometry/inst/private/lineGeo.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/private/lineGeo.m 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,29 @@ +%% Copyright (c) 2010 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} @var{str} = lineGeo (@var{n}, @var{pi}, @var{pj}) +%% Generates a string for Gmsh Line format. +%% +%% Curves are Gmsh's second type of elementery entities, and, +%% amongst curves, straight lines are the simplest. A straight line is +%% defined by a list of point numbers. The initial point @var{pi}, the final +%% point @var{pj}. @var{n} is an indetifier for the line. +%% +%% @end deftypefn + +function str = lineGeo(n,i,j) + str = sprintf('Line(%d) = {%d,%d};\n',n,i,j); +end Added: trunk/octave-forge/main/geometry/inst/private/lineLoopGeo.m =================================================================== --- trunk/octave-forge/main/geometry/inst/private/lineLoopGeo.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/private/lineLoopGeo.m 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,32 @@ +%% Copyright (c) 2010 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} @var{str} = lineLoopGeo (@var{id}, @var{nl}, @var{lns}) +%% Generates a string for Gmsh Line Loop format. +%% +%% The third elementary entity is the surface. In order to define a +%% simple rectangular surface from defined lines, a +%% line loop has first to be defined. A line loop is a list of +%% connected lines, a sign being associated with each line (depending +%% on the orientation of the line). @var{id} is an indentifier for the loop. +%% @var{nl} is the number of lines in the loop. @var{lns} is the list of lines. +%% +%% @end deftypefn + +function str = lineLoopGeo(id,nl,lns) + substr = repmat(',%d',1,nl-1); + str = sprintf(['Line Loop(%d) = {%d' substr '};\n'],id,lns); +end Added: trunk/octave-forge/main/geometry/inst/private/planeSurfGeo.m =================================================================== --- trunk/octave-forge/main/geometry/inst/private/planeSurfGeo.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/private/planeSurfGeo.m 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,36 @@ +%% Copyright (c) 2010 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} @var{str} = planeSurfGeo (@var{id}, @var{nloop},@var{loops}) +%% Generates a string for Gmsh Plane Surface format. +%% +%% @var{id} is the plane surface's identification number. +%% @var{nloop} is the number of loops defining the surface. +%% @var{loops} contain the identification numbers of all the line loops defining +%% the surface. The first line loop defines the exterior boundary of the surface; +%% all other line loops define holes in the surface. A line loop defining a hole +%% should not have any lines in common with the exterior line loop (in which case +%% it is not a hole, and the two surfaces should be defined separately). +%% Likewise, a line loop defining a hole should not have any lines in common with +%% another line loop defining a hole in the same surface (in which case the two +%% line loops should be combined). +%% +%% @end deftypefn + +function str = planeSurfGeo(id,nloop,loops) + substr = repmat(',%d',1,nloop-1); + str = sprintf(['Plane Surface(%d) = {%d' substr '};\n'],id,loops); +end Added: trunk/octave-forge/main/geometry/inst/private/pointGeo.m =================================================================== --- trunk/octave-forge/main/geometry/inst/private/pointGeo.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/private/pointGeo.m 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,32 @@ +%% Copyright (c) 2010 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} @var{str} = poointGeo (@var{n}, @var{xyz}, @var{l}) +%% Generates a string for Gmsh Point format. +%% +%% Gmsh's simplest `elementary entity', a `Point'. A Point is defined by a list +%% of five numbers: @var{n} the identificator, @var{xyz} three coordinates (X, Y +%% and Z), and a characteristic length @var{l} that sets the target element size +%% at the point: +%% The distribution of the mesh element sizes is then obtained by +%% interpolation of these characteristic lengths throughout the +%% geometry. +%% +%% @end deftypefn + +function str = pointGeo(n,xyz,l) + str = sprintf('Point(%d) = {%f,%f,%f,%f};\n',n,xyz,l); +end Added: trunk/octave-forge/main/geometry/inst/private/ruledSurfGeo.m =================================================================== --- trunk/octave-forge/main/geometry/inst/private/ruledSurfGeo.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/private/ruledSurfGeo.m 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,39 @@ +%% Copyright (c) 2010 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} @var{str} = ruledSurfGeo (@var{id}, @var{nloop}, @var{loops}, @var{centerid}) +%% Generates a string for Gmsh Ruled Surface format. +%% +%% Creates a ruled surface with identifier @var{id}, i.e., a surface that can be +%% interpolated using transfinite interpolation. @var{nloop} indicates the number +%% of loops that define the surface. @var{loops} should contain the identification +%% number of a line loop composed of either three or four elementary lines. +%% @var{centerid} is the identification number of the center of the sphere, this +%% forces the surface to be a spherical patch. +%% +%% @end deftypefn + +function str = ruledSurfGeo(id,nloop,loops,centerid) + substr = repmat(',%d',1,nloop-1); + + if ~isempty(centerid) + str = sprintf(['Ruled Surface(%d) = {%d' substr '} In Sphere {%d};\n'], ... + id,loops,centerid); + else + error('data2geo:Error',"The id of the centers shouldn't be empty"); + end + +end Added: trunk/octave-forge/main/geometry/inst/svgload.m =================================================================== --- trunk/octave-forge/main/geometry/inst/svgload.m (rev 0) +++ trunk/octave-forge/main/geometry/inst/svgload.m 2011-09-26 21:01:25 UTC (rev 8606) @@ -0,0 +1,62 @@ +%% Copyright (c) 2011 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +%% -*- texinfo -*- +%% @deftypefn {Function File} @var{SVG} = loadSVG (@var{filename}) +%% Reads the plain SVG file @var{filename} and retunrs an SVG structure. +%% +%% In the current version only SVG path elements are parsed and stored in the field +%% path of the @var{SVG} structure. +%% The coordinates of the path are not modified in anyway. This produces the path +%% to be ploted vertically reflected. +%% +%% @seealso{svgnormalize, svgpath2polygon} +%% @end deftypefn + + +function SVG = svgload (filename) + + SVG = struct ('height', [], 'width... [truncated message content] |
From: <jpi...@us...> - 2011-09-27 13:21:58
|
Revision: 8615 http://octave.svn.sourceforge.net/octave/?rev=8615&view=rev Author: jpicarbajal Date: 2011-09-27 13:21:48 +0000 (Tue, 27 Sep 2011) Log Message: ----------- geometry-1.0.0. adding NEWS Added Paths: ----------- trunk/octave-forge/main/geometry/doc/ trunk/octave-forge/main/geometry/doc/NEWS Added: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS (rev 0) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-09-27 13:21:48 UTC (rev 8615) @@ -0,0 +1,10 @@ +Summary of important user-visible changes for releases of the geometry package + +=============================================================================== +geometry-1.0.0 Release Date: 2011-09-26 Release Manager: Juan Pablo Carbajal +=============================================================================== + +** First official release. + + +=============================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-09-27 17:26:15
|
Revision: 8626 http://octave.svn.sourceforge.net/octave/?rev=8626&view=rev Author: jpicarbajal Date: 2011-09-27 17:26:08 +0000 (Tue, 27 Sep 2011) Log Message: ----------- geometry. Update of description files Modified Paths: -------------- trunk/octave-forge/main/geometry/DESCRIPTION trunk/octave-forge/main/geometry/doc/NEWS Modified: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION 2011-09-27 17:19:15 UTC (rev 8625) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2011-09-27 17:26:08 UTC (rev 8626) @@ -1,6 +1,6 @@ Name: Geometry -Version: 1.0.0 -Date: Thursday, September 22 2011 +Version: 1.0.1 +Date: Tuesday, September 27 2011 Author: David Legland <dav...@gr...>, Juan Pablo Carbajal <car...@if...> Maintainer: Juan Pablo Carbajal <car...@if...> Title: Computational Geometry Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-09-27 17:19:15 UTC (rev 8625) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-09-27 17:26:08 UTC (rev 8626) @@ -6,5 +6,10 @@ ** First official release. +=============================================================================== +geometry-1.0.1 Release Date: 2011-09-27 Release Manager: Juan Pablo Carbajal +=============================================================================== +Improvements to the docstrings of all functions. + =============================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-03 19:56:19
|
Revision: 8663 http://octave.svn.sourceforge.net/octave/?rev=8663&view=rev Author: jpicarbajal Date: 2011-10-03 19:56:05 +0000 (Mon, 03 Oct 2011) Log Message: ----------- geometry. Adding matGeom Modified Paths: -------------- trunk/octave-forge/main/geometry/DESCRIPTION Added Paths: ----------- trunk/octave-forge/main/geometry/matGeom_raw/ trunk/octave-forge/main/geometry/matGeom_raw/COPYING trunk/octave-forge/main/geometry/matGeom_raw/Contents.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoParabolaCurvature/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoParabolaCurvature/demoParabolaCurvature.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoParabolaCurvature/html/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoParabolaCurvature/html/demoParabolaCurvature.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoParabolaCurvature/html/demoParabolaCurvature.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoParabolaCurvature/html/demoParabolaCurvature_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoParabolaCurvature/html/demoParabolaCurvature_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoPolynomialCurveProjection/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoPolynomialCurveProjection/demoPolynomialCurveProjection.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoPolynomialCurveProjection/html/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoPolynomialCurveProjection/html/demoPolynomialCurveProjection.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoPolynomialCurveProjection/html/demoPolynomialCurveProjection.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoPolynomialCurveProjection/html/demoPolynomialCurveProjection_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/demoPolynomialCurveProjection/html/demoPolynomialCurveProjection_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/triangle/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/triangle/compTriangle.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/triangle/html/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/triangle/html/triangleDemo.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/triangle/html/triangleDemo.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/triangle/html/triangleDemo_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/triangle/html/triangleDemo_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/triangle/html/triangleDemo_03.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/triangle/html/triangleDemo_04.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/triangle/triangle.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom2d/triangle/triangleDemo.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/capsC26-1-5-10.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/demoGeom3d/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/demoGeom3d/demoGeom3d.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/demoGeom3d/html/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/demoGeom3d/html/demoGeom3d.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/demoGeom3d/html/demoGeom3d.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/demoGeom3d/html/demoGeom3d_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/demoGeom3d/html/demoGeom3d_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/demoGeom3d/html/demoGeom3d_03.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/demoRevolutionSurface.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/drawSoccerBall/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/drawSoccerBall/drawSoccerBall.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/drawSoccerBall/html/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/drawSoccerBall/html/drawSoccerBall.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/drawSoccerBall/html/drawSoccerBall.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/drawSoccerBall/html/drawSoccerBall_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/drawSoccerBall/html/drawSoccerBall_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/drawSoccerBall/html/drawSoccerBall_03.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/demoGeom3d.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/demoInertiaEllipsoid.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/drawSoccerBall.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/drawVoronoiCell.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/demoGeom3d.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/demoGeom3d.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/demoGeom3d_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/demoGeom3d_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/demoGeom3d_03.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/demoInertiaEllipsoid.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/demoInertiaEllipsoid.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/demoInertiaEllipsoid_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/demoInertiaEllipsoid_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/drawSoccerBall.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/drawSoccerBall.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/drawSoccerBall_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/drawSoccerBall_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/drawSoccerBall_03.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/drawVoronoiCell.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/drawVoronoiCell.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/drawVoronoiCell_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/drawVoronoiCell_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/geom3d-demos/html/drawVoronoiCell_03.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/geom3d/triangulateFacesDemo.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/demoPolyhedra/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/demoPolyhedra/demoPolyhedra.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/demoPolyhedra/html/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/demoPolyhedra/html/demoPolyhedra.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/demoPolyhedra/html/demoPolyhedra.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/demoPolyhedra/html/demoPolyhedra_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/drawVoronoiCell/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/drawVoronoiCell/drawVoronoiCell.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/drawVoronoiCell/html/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/drawVoronoiCell/html/drawVoronoiCell.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/drawVoronoiCell/html/drawVoronoiCell.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/drawVoronoiCell/html/drawVoronoiCell_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/drawVoronoiCell/html/drawVoronoiCell_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/meshes3d/drawVoronoiCell/html/drawVoronoiCell_03.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoExpandPolygon/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoExpandPolygon/demoExpandPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoExpandPolygon/html/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoExpandPolygon/html/demoExpandPolygon.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoExpandPolygon/html/demoExpandPolygon.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoExpandPolygon/html/demoExpandPolygon_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoExpandPolygon/html/demoExpandPolygon_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoExpandPolygon/html/demoExpandPolygon_03.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoOnionPeeling/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoOnionPeeling/demoOnionPeeling.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoOnionPeeling/html/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoOnionPeeling/html/demoOnionPeeling.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoOnionPeeling/html/demoOnionPeeling.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoOnionPeeling/html/demoOnionPeeling_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoOnionPeeling/html/demoOnionPeeling_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/demoOnionPeeling/html/demoOnionPeeling_03.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/demoMedialAxis.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/drawCrackPattern.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/drawCrackPattern2.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/drawPoissonLines.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/drawVoronoi.m trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/exempleCracks.eps trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/exempleCracks.fig trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/exemplePoissonLines.eps trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/exemplePoissonLines.fig trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/exempleVoronoi.eps trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/exempleVoronoi.fig trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/ trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/demoMedialAxis.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/demoMedialAxis.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/demoMedialAxis_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawCrackPattern.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawCrackPattern.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawCrackPattern2.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawCrackPattern2.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawCrackPattern2_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawCrackPattern_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawPoissonLines.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawPoissonLines.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawPoissonLines_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawPoissonLines_02.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawVoronoi.html trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawVoronoi.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/html/drawVoronoi_01.png trunk/octave-forge/main/geometry/matGeom_raw/Demos/polygons2d/tessel/lines3d.fig trunk/octave-forge/main/geometry/matGeom_raw/README trunk/octave-forge/main/geometry/matGeom_raw/Tests/ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngle2Points.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngle3Points.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngleSort.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testBisector.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCentroid.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCliPoints.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipEdge.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipLine.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipPoints.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipRay.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateCircle.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateLine.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateRay.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateRotation.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateScaling.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateTranslation.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testDistancePointEdge.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testDistancePoints.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testDrawLine.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testDrawRect.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testEdgeLength.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectBoxes.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectCircles.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectEdges.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectLineCircle.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectLines.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIsCounterClockwise.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIsParallel.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIsPerpendicular.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIsPointOnEdge.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testLineAngle.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testLinePosition.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testMedianLine.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testMergeBoxes.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testMidPoint.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testMinDistancePoints.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testNormalizeAngle.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testProjPointOnLine.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testVectorAngle.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testVectorNorm.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/test_angleAbsDiff.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/test_angleDiff.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/test_triangleArea.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testCart2sph2.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testCart2sph2d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testCirclePosition.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testClipLine3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testCreateRotationOx.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testCreateRotationOy.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testCreateRotationOz.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testDistanceLines3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testDistancePointLine3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testDistancePointPlane.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testDrawEdge3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testEulerAngles.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testIntersectBoxes3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testIntersectEdgePlane.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testIntersectLineCylinder.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testIntersectLinePolygon3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testIntersectLineSphere.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testIntersectLineTriangle3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testIntersectPlaneSphere.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testIntersectRayPolygon3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testIsParallel3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testIsPerpendicular3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testLinePosition3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testMergeBoxes3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testMidPoint3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testNormalizeVector3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testSph2cart2.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testSph2cart2d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testSphericalAngle.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testTransformLine3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testTransformPoint3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testTransformVector3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/testVectorAngle3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/test_clipConvexPolygon3dHP.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/test_clipPolygon3dHP.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom3d/test_triangleArea3d.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/ trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/createTestGraph01.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/createTestGraph02.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/createTestGraph03.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/testGrClose.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/testGrDilate.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/testGrErode.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/testGrFindGeodesicPath.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/testGrFindMaximalLengthPath.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/testGrNodeDegree.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/testGrOpen.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/testGraphCenter.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/testGraphDiameter.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/testGraphPeripheralVertices.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/graphs/testGraphRadius.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/meshes3d/ trunk/octave-forge/main/geometry/matGeom_raw/Tests/meshes3d/testCreateCube.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/meshes3d/testCreateCubeOctaedron.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/meshes3d/testCreateDodecahedron.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/meshes3d/testCreateIcosahedron.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/meshes3d/testCreateOctahedron.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/meshes3d/testCreateRhombododecahedron.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/meshes3d/testCreateSoccerBall.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/meshes3d/testCreateTetrahedron.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/meshes3d/testCreateTetrakaidecahedron.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/ trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testDistancePointPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testDistancePointPolyline.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testExpandPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testIntersectLinePolygon.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testIntersectPolylines.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testIntersectRayPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testIsPointInTriangle.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testMinimumCaliperDiameter.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testParametrize.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testPolygonArea.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testPolygonLength.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testPolygonNormalAngle.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testPolygonPoint.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testPolygonSelfIntersections.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testPolygonSubcurve.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testPolygonToRow.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testPolylineLength.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testPolylinePoint.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/polygons2d/testRowToPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/runAllTests.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/Contents.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle2Points.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/bisector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/cartesianLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/changelog.txt trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleArcAsCurve.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleAsPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circles2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLineRect.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipPoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/crackPattern.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/crackPattern2.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createBasisTransform.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createDirectedCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createHomothecy.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLineReflection.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createMedian.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRotation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createScaling.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createTranslation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/deg2rad.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePointEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePointLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawArrow.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBezierCurve.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBox.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCenteredEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCircleArc.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEllipse.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEllipseArc.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLabels.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawOrientedBox.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawParabola.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRect.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRect2.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawShape.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeLength.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgePosition.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeToLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edges2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/ellipseAsPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/ellipses2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/enclosingCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/fitAffineTransform2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/formatAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/hexagonalGrid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/homothecy.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/inCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/inertiaEllipse.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectBoxes.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectCircles.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectEdges.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLineCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLineEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLines.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/invertLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isCounterClockwise.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isLeftOriented.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isParallel.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPerpendicular.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInEllipse.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineFit.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/linePosition.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineSymmetry.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lines2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/medianLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/mergeBoxes.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/midPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/minDistance.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/minDistancePoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalize.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/onCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/onEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/onLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/onRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/orthogonalLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/parallelLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/pointOnLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/points2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/polarPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/projPointOnLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rad2deg.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/radicalAxis.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/randomPointInBox.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rays2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/readme.txt trunk/octave-forge/main/geometry/matGeom_raw/geom2d/reverseEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/reverseLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rotateVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rotation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/scaling.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/squareGrid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transforms2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/translation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/triangleGrid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vecnorm.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorNorm.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectors2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/ trunk/octave-forge/main/geometry/matGeom_raw/geom3d/Contents.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/anglePoints3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/angleSort3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/angles3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/box3dVolume.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/boxes3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/cart2cyl.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/cart2sph2.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/cart2sph2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/changelog.txt trunk/octave-forge/main/geometry/matGeom_raw/geom3d/changes.txt trunk/octave-forge/main/geometry/matGeom_raw/geom3d/circle3dOrigin.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/circle3dPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/circle3dPosition.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/circles3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/clipConvexPolygon3dHP.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/clipLine3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/clipPoints3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/clipPolygon3dHP.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/composeTransforms3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/createBasisTransform3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/createEulerAnglesRotation.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/createLine3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/createPlane.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/createRotation3dLineAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/createRotationOx.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/createRotationOy.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/createRotationOz.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/createScaling3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/createSphere.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/createTranslation3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/cyl2cart.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/dihedralAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/distanceLines3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/distancePointLine3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/distancePointPlane.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/distancePoints3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawAxis3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawAxisCube.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawBox3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawCircle3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawCircleArc3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawCube.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawCuboid.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawCurve3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawCylinder.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawEdge3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawEllipse3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawEllipsoid.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawGrid3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawLine3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawPartialPatch.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawPlane3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawPoint3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawPolygon3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawPolyline3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawSphere.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawSphericalTriangle.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawSurfPatch.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/drawTorus.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/eulerAnglesToRotation3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/fillPolygon3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/inertiaEllipsoid.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/intersectBoxes3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/intersectEdgePlane.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/intersectLineCylinder.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/intersectLinePlane.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/intersectLinePolygon3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/intersectLineSphere.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/intersectLineTriangle3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/intersectPlaneLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/intersectPlaneSphere.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/intersectPlanes.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/intersectRayPolygon3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/isBelowPlane.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/isCoplanar.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/isParallel3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/isPerpendicular3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/linePosition3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/lines3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/medianPlane.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/mergeBoxes3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/midPoint3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/normalize3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/normalizePlane.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/normalizeVector3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/planeNormal.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/planePoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/planePosition.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/planes3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/point3dBounds.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/points3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/polygon3dNormalAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/polygonCentroid3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/polygons3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/private/ trunk/octave-forge/main/geometry/matGeom_raw/geom3d/private/localToGlobal3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/projPointOnPlane.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/randomAngle3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/randomPointInBox3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/readme.txt trunk/octave-forge/main/geometry/matGeom_raw/geom3d/recenterTransform3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/revolutionSurface.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/rotation3dAxisAndAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/rotation3dToEulerAngles.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/rotationOx.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/rotationOy.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/rotationOz.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/scale3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/scaling3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/sph2cart2.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/sph2cart2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/spheres.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/sphericalAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/surfaceCurvature.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/transformLine3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/transformPoint3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/transformVector3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/transforms3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/translation3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/triangleArea3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/vecnorm3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/vectorAngle3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/vectorNorm3d.m trunk/octave-forge/main/geometry/matGeom_raw/geom3d/vectors3d.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/ trunk/octave-forge/main/geometry/matGeom_raw/graphs/Contents.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/addSquareFace.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/boundaryGraph.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/boundedVoronoi2d.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/centroidalVoronoi2d.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/clipGraph.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/cvtIterate.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/cvtUpdate.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/delaunayGraph.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/drawDigraph.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/drawDirectedEdges.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/drawEdgeLabels.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/drawGraph.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/drawGraphEdges.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/drawGraphFaces.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/drawNodeLabels.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/drawSquareMesh.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/euclideanMST.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/gcontour2d.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/gcontour3d.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grClose.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grDilate.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grErode.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grFaceToPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grFindGeodesicPath.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grFindMaximalLengthPath.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grLabel.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grMean.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grMedian.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grMergeMultipleEdges.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grMergeMultipleNodes.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grMergeNodeClusters.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grMergeNodes.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grMergeNodesMedian.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grNeighborEdges.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grNeighborNodes.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grNodeDegree.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grNodeInnerDegree.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grNodeOuterDegree.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grOpen.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grOppositeNode.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grPropagateDistance.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grRemoveEdge.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grRemoveEdges.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grRemoveMultiplePoints.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grRemoveNode.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grRemoveNodes.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grSimplifyBranches.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grSimplifyBranches_old.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/grVertexEccentricity.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/graph2Contours.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/graphCenter.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/graphDiameter.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/graphPeripheralVertices.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/graphRadius.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/imageGraph.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/knnGraph.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/mergeGraphs.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/patchGraph.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/prim_mst.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/quiverToGraph.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/vectorize.m trunk/octave-forge/main/geometry/matGeom_raw/graphs/voronoi2d.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/ trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/Contents.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/changelog.txt trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/checkMeshAdjacentFaces.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/clipConvexPolyhedronHP.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/clipMeshVertices.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/computeMeshEdges.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/createCube.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/createCubeOctahedron.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/createDodecahedron.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/createIcosahedron.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/createMengerSponge.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/createOctahedron.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/createRhombododecahedron.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/createSoccerBall.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/createTetrahedron.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/createTetrakaidecahedron.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/drawFaceNormals.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/drawMesh.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/drawPolyhedra.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/drawPolyhedron.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/faceCentroids.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/faceNormal.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/meshDihedralAngles.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/meshEdgeFaces.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/meshEdgeLength.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/meshFace.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/meshReduce.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/meshSurfaceArea.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/minConvexHull.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/polyhedra.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/polyhedronMeanBreadth.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/polyhedronNormalAngle.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/polyhedronSlice.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/private/ trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/private/formatMeshOutput.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/private/parseMeshData.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/steinerPolytope.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/triangulateFaces.m trunk/octave-forge/main/geometry/matGeom_raw/meshes3d/trimeshSurfaceArea.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/ trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/Contents.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/cart2geod.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/changelog.txt trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/clipPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/clipPolygonHP.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/convexHull.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/convexification.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/curvature.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/curveCMoment.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/curveCSMoment.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/curveCentroid.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/curveLength.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/curveMoment.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/distancePointPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/distancePointPolyline.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/distancePolygons.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/distancePolylines.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/drawCurve.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/drawPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/drawPolyline.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/expandPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/fillPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/findPoint.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/geod2cart.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/intersectLinePolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/intersectPolylines.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/intersectRayPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/isPointInPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/isPointInTriangle.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/isPointOnPolyline.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/medialAxisConvex.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/minimumCaliperDiameter.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/parametrize.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/pointSetBounds.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/pointSetsAverage.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polygonArea.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polygonBounds.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polygonCentroid.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polygonContains.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polygonExpand.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polygonLength.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polygonLoops.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polygonNormalAngle.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polygonPoint.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polygonSelfIntersections.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polygonSubcurve.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polygonToRow.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polylineCentroid.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polylineLength.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polylinePoint.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polylineSelfIntersections.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/polylineSubcurve.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/private/ trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/private/InterX.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/projPointOnPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/projPointOnPolyline.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/readPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/rectAsPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/reversePolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/reversePolyline.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/rowToPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/splitPolygons.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/steinerPoint.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/steinerPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/subCurve.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/supportFunction.m trunk/octave-forge/main/geometry/matGeom_raw/polygons2d/triangleArea.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/ trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/Contents.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/drawPolynomialCurve.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polyfit2.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polynomialCurveCentroid.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polynomialCurveCurvature.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polynomialCurveCurvatures.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polynomialCurveDerivative.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polynomialCurveFit.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polynomialCurveLength.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polynomialCurveNormal.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polynomialCurvePoint.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polynomialCurvePosition.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polynomialCurveProjection.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polynomialCurveSetFit.m trunk/octave-forge/main/geometry/matGeom_raw/polynomialCurves2d/polynomialDerivate.m trunk/octave-forge/main/geometry/matGeom_raw/setupMatGeom.m Modified: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION 2011-10-03 18:21:42 UTC (rev 8662) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2011-10-03 19:56:05 UTC (rev 8663) @@ -7,5 +7,5 @@ Description: Library for geometric computing extending MatGeom functions. Useful to create, transform, manipulate and display geometric primitives. Depends: octave (>= 3.4.0) Autoload: no -License: GPL version 3 or later +License: GPL version 3 and BSD (see files) Url: http://octave.sf.net, http://matgeom.sf.net Added: trunk/octave-forge/main/geometry/matGeom_raw/COPYING =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/COPYING (rev 0) +++ trunk/octave-forge/main/geometry/matGeom_raw/COPYING 2011-10-03 19:56:05 UTC (rev 8663) @@ -0,0 +1,29 @@ +Copyright (c) 2011, INRA +All rights reserved. +(simplified BSD License) + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +The views and conclusions contained in the software and documentation are +those of the authors and should not be interpreted as representing official +policies, either expressed or implied, of copyright holder. Added: trunk/octave-forge/main/geometry/matGeom_raw/Contents.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Contents.m (rev 0) +++ trunk/octave-forge/main/geometry/matGeom_raw/Contents.m 2011-10-03 19:56:05 UTC (rev 8663) @@ -0,0 +1,29 @@ +%MATGEOM Geometric Computing Toolbox +% Version 1.0 21-Mar-2011 . +% +% MatGeom Provides low-level functions for geometric computing. It is +% possible to create, display, compute intersections... of various +% geometrical primitives, in 2D and 3D. +% +% The library is organized into several modules: +% geom2d - General function in euclidean plane +% polygons2d - Functions operating on point lists +% polynomialCurves2d - Representation of smooth polynomial curves +% geom3d - General function in 3D euclidean space +% meshes3d - Manipulation of 3D surfacic meshes +% +% Type 'help(MODULENAME)' for further info. +% +% To install the library, with all sub-directories, run the script +% 'setupMatGeom'. +% +% +% ------ +% Author: David Legland +% e-mail: david.legl... [truncated message content] |
From: <jpi...@us...> - 2011-10-03 21:03:52
|
Revision: 8664 http://octave.svn.sourceforge.net/octave/?rev=8664&view=rev Author: jpicarbajal Date: 2011-10-03 21:03:42 +0000 (Mon, 03 Oct 2011) Log Message: ----------- geometry. Starting adaptation of matGeom Modified Paths: -------------- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/Contents.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/bisector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/cartesianLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/changelog.txt trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleArcAsCurve.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleAsPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circles2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLineRect.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipPoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/crackPattern.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/crackPattern2.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createBasisTransform.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createDirectedCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createHomothecy.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLineReflection.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createMedian.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRotation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createScaling.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createTranslation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/deg2rad.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePointEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePointLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawArrow.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBezierCurve.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBox.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCenteredEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCircleArc.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEllipse.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEllipseArc.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLabels.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawOrientedBox.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawParabola.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRect.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRect2.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawShape.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeLength.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgePosition.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeToLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edges2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/ellipseAsPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/ellipses2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/enclosingCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/fitAffineTransform2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/formatAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/hexagonalGrid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/homothecy.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/inCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/inertiaEllipse.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectBoxes.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectCircles.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectEdges.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLineCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLineEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLines.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/invertLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isCounterClockwise.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isLeftOriented.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isParallel.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPerpendicular.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInEllipse.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineFit.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/linePosition.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineSymmetry.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lines2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/medianLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/mergeBoxes.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/midPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/minDistance.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/minDistancePoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalize.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/onCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/onEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/onLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/onRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/orthogonalLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/parallelLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/pointOnLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/points2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/polarPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/projPointOnLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rad2deg.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/radicalAxis.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/randomPointInBox.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rays2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/readme.txt trunk/octave-forge/main/geometry/matGeom_raw/geom2d/reverseEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/reverseLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rotateVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rotation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/scaling.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/squareGrid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transforms2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/translation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/triangleGrid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vecnorm.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorNorm.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectors2d.m Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/ trunk/octave-forge/main/geometry/geom2d/angle2Points.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle2Points.m Copied: trunk/octave-forge/main/geometry/geom2d/angle2Points.m (from rev 8663, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle2Points.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/angle2Points.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/angle2Points.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -0,0 +1,86 @@ +%% Copyright (c) 2007-2011, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{alpha} =} angle2Points (@var{p1}, @var{p2}) +%% Compute horizontal angle between 2 points +%% +%% @var{p1} and @var{p2} are either [1x2] arrays, or [Nx2] arrays, in this case +%% @var{alpha} is a [Nx1] array. The angle computed is the horizontal angle of +%% the line (@var{p1},@var{p2}). +%% +%% Result is always given in radians, between 0 and 2*pi. +%% +%% @seealso{points2d, angles2d, angle3points, normalizeAngle, vectorAngle} +%% +%% @end deftypefn + +function theta = angle2Points(varargin) + + % process input arguments + if length(varargin)==2 + p1 = varargin{1}; + p2 = varargin{2}; + elseif length(varargin)==1 + var = varargin{1}; + p1 = var(1,:); + p2 = var(2,:); + end + + % ensure data have correct size + n1 = size(p1, 1); + n2 = size(p2, 1); + if n1~=n2 && min(n1, n2)>1 + error('angle2Points: wrong size for inputs'); + end + + % angle of line (P2 P1), between 0 and 2*pi. + dp = bsxfun(@minus, p2, p1); + theta = mod(atan2(dp(:,2), dp(:,1)) + 2*pi, 2*pi); + +endfunction + +%!test +%! % all points inside window, possibly touching edges +%! p1 = [0 0]; +%! p2 = [10 0]; +%! angle_ = angle2Points (p1, p2); +%! assert (angle_,0,1e-6); +%! angle_ = angle2Points (p2, p1); +%! assert (angle_,pi,1e-6); + + +%!test +%! % all points inside window, possibly touching edges +%! p1 = [0 0]; +%! p2 = [0 10]; +%! angle_ = angle2Points (p1, p2); +%! assert (pi/2, angle_,1e-6); +%! angle_ = angle2Points (p2, p1); +%! assert (3*pi/2, angle_,1e-6); + +%!test +%! % all points inside window, possibly touching edges +%! p1 = [0 0;0 0;0 0;0 0]; +%! p2 = [10 0;10 10;0 10;-10 10]; +%! angle_ = angle2Points (p1, p2); +%! assert (size (p1, 1), size (angle_, 1)); +%! res = [0;pi/4;pi/2;3*pi/4]; +%! assert (res, angle_, 1e-6); + +%!test +%! % all points inside window, possibly touching edges +%! p1 = [0 0]; +%! p2 = [10 0;10 10;0 10;-10 10]; +%! angle_ = angle2Points (p1, p2); +%! assert(size (p2, 1), size (angle_, 1)); +%! res = [0;pi/4;pi/2;3*pi/4]; +%! assert(res, angle_,1e-6); + Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/Contents.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/Contents.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/Contents.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + % GEOM2D Geometry 2D Toolbox % Version 1.0 21-Mar-2011 . % Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle2Points.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle2Points.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle2Points.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,43 +0,0 @@ -function theta = angle2Points(varargin) -%ANGLE2POINTS Compute horizontal angle between 2 points -% -% ALPHA = angle2Points(P1, P2), -% Pi are either [1*2] arrays, or [N*2] arrays, in this case ALPHA is a -% [N*1] array. The angle computed is the horizontal angle of the line -% (P1 P2) -% Result is always given in radians, between 0 and 2*pi. -% -% See Also: -% points2d, angles2d, angle3points, normalizeAngle, vectorAngle -% -% -% --------- -% Author: David Legland -% e-mail: dav...@gr... -% created the 02/03/2007. -% Copyright 2010 INRA - Cepia Software Platform. - -% HISTORY: -% 2011-01-11 use bsxfun - -% process input arguments -if length(varargin)==2 - p1 = varargin{1}; - p2 = varargin{2}; -elseif length(varargin)==1 - var = varargin{1}; - p1 = var(1,:); - p2 = var(2,:); -end - -% ensure data have correct size -n1 = size(p1, 1); -n2 = size(p2, 1); -if n1~=n2 && min(n1, n2)>1 - error('angle2Points: wrong size for inputs'); -end - -% angle of line (P2 P1), between 0 and 2*pi. -dp = bsxfun(@minus, p2, p1); -theta = mod(atan2(dp(:,2), dp(:,1)) + 2*pi, 2*pi); - Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function theta = angle3Points(varargin) %ANGLE3POINTS Compute oriented angle made by 3 points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function dif = angleAbsDiff(angle1, angle2) %ANGLEABSDIFF Absolute difference between two angles % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function dif = angleDiff(angle1, angle2) %ANGLEDIFF Difference between two angles % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = angleSort(pts, varargin) %ANGLESORT Sort points in the plane according to their angle to origin % @@ -62,4 +72,4 @@ varargout{2} = I; end - \ No newline at end of file + Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function angles2d %ANGLES2D Description of functions for manipulating angles % @@ -21,4 +31,4 @@ % Copyright 2010 INRA - Cepia Software Platform. -help('angles2d'); \ No newline at end of file +help('angles2d'); Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/bisector.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/bisector.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/bisector.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function ray = bisector(varargin) %BISECTOR Return the bisector of two lines, or 3 points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function boxes2d(varargin) %BOXES2D Description of functions operating on bounding boxes % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/cartesianLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/cartesianLine.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/cartesianLine.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function line = cartesianLine(varargin) %CARTESIANLINE Create a straight line from cartesian equation coefficients % @@ -35,4 +45,4 @@ dx = cos(theta); dy = sin(theta); -line = [x0 y0 dx dy]; \ No newline at end of file +line = [x0 y0 dx dy]; Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function center = centroid(varargin) %CENTROID Compute centroid (center of mass) of a set of points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/changelog.txt =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/changelog.txt 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/changelog.txt 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + change log for geom2d geom2d, release 2011.??.?? @@ -155,4 +165,4 @@ - fixed bug in intersectEdges many updates in doc. - \ No newline at end of file + Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleArcAsCurve.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleArcAsCurve.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleArcAsCurve.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = circleArcAsCurve(arc, N) %CIRCLEARCASCURVE Convert a circle arc into a series of points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleAsPolygon.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleAsPolygon.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleAsPolygon.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = circleAsPolygon(circle, varargin) %CIRCLEASPOLYGON Convert a circle into a series of points % @@ -44,4 +54,4 @@ elseif nargout==2 varargout{1}=x; varargout{2}=y; -end \ No newline at end of file +end Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circles2d.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circles2d.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circles2d.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function circles2d(varargin) %CIRCLES2D Description of functions operating on circles % @@ -28,4 +38,4 @@ % Created: 2008-10-13, using Matlab 7.4.0.287 (R2007a) % Copyright 2010 INRA - Cepia Software Platform. -help('circles2d'); \ No newline at end of file +help('circles2d'); Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function edge2 = clipEdge(edge, box) %CLIPEDGE Clip an edge with a rectangular box % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function edge = clipLine(line, box, varargin) %CLIPLINE Clip a line with a box % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLineRect.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLineRect.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLineRect.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function edge = clipLineRect(line, rect) %CLIPLINERECT clip a line with a polygon % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipPoints.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipPoints.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipPoints.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function points = clipPoints(points, box) %CLIPPOINTS Clip a set of points by a box % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipRay.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipRay.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipRay.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function [edge isInside] = clipRay(ray, box) % Clip a ray with a box % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/crackPattern.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/crackPattern.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/crackPattern.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function edges = crackPattern(box, points, alpha, varargin) %CRACKPATTERN Create a (bounded) crack pattern tessellation % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/crackPattern2.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/crackPattern2.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/crackPattern2.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function edges = crackPattern2(box, points, alpha, varargin) %CRACKPATTERN2 Create a (bounded) crack pattern tessellation % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createBasisTransform.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createBasisTransform.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createBasisTransform.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function transfo = createBasisTransform(source, target) %CREATEBASISTRANSFORM Compute matrix for transforming a basis into another basis % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createCircle.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createCircle.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createCircle.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function circle = createCircle(varargin) %CREATECIRCLE Create a circle from 2 or 3 points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createDirectedCircle.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createDirectedCircle.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createDirectedCircle.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function circle = createDirectedCircle(varargin) %CREATEDIRECTEDCIRCLE Create a directed circle % @@ -55,4 +65,4 @@ end -circle = [x0 y0 r d]; \ No newline at end of file +circle = [x0 y0 r d]; Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createEdge.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createEdge.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createEdge.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function edge = createEdge(varargin) %CREATEEDGE Create an edge between two points, or from a line % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createHomothecy.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createHomothecy.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createHomothecy.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function trans = createHomothecy(point, ratio) %CREATEHOMOTHECY Create the the 3x3 matrix of an homothetic transform % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLine.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLine.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function line = createLine(varargin) %CREATELINE Create a straight line from 2 points, or from other inputs % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLineReflection.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLineReflection.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLineReflection.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function trans = createLineReflection(line) %CREATELINEREFLECTION Create the the 3x3 matrix of a line reflection % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createMedian.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createMedian.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createMedian.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function line = createMedian(varargin) %CREATEMEDIAN create a median line % @@ -55,4 +65,4 @@ end -line = [x0+dx/2, y0+dy/2, -dy, dx]; \ No newline at end of file +line = [x0+dx/2, y0+dy/2, -dy, dx]; Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRay.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRay.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRay.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function ray = createRay(varargin) %CREATERAY Create a ray (half-line), from various inputs % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRotation.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRotation.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRotation.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function trans = createRotation(varargin) %CREATEROTATION Create the 3*3 matrix of a rotation % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createScaling.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createScaling.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createScaling.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function trans = createScaling(varargin) %CREATESCALING Create the 3*3 matrix of a scaling in 2 dimensions % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createTranslation.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createTranslation.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createTranslation.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function trans = createTranslation(varargin) %CREATETRANSLATION Create the 3*3 matrix of a translation % @@ -38,4 +48,4 @@ end % create the matrix representing the translation -trans = [1 0 tx ; 0 1 ty ; 0 0 1]; \ No newline at end of file +trans = [1 0 tx ; 0 1 ty ; 0 0 1]; Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createVector.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createVector.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createVector.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function vect = createVector(p1, p2) %CREATEVECTOR Create a vector from two points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/deg2rad.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/deg2rad.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/deg2rad.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function rad = deg2rad(deg) %DEG2RAD Convert angle from degrees to radians % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePointEdge.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePointEdge.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePointEdge.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = distancePointEdge(point, edge) %DISTANCEPOINTEDGE Minimum distance between a point and an edge % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePointLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePointLine.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePointLine.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function dist = distancePointLine(point, line) %DISTANCEPOINTLINE Minimum distance between a point and a line % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePoints.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePoints.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePoints.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function dist = distancePoints(p1, p2, varargin) %DISTANCEPOINTS Compute distance between two points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawArrow.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawArrow.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawArrow.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawArrow(varargin) %DRAWARROW Draw an arrow on the current axis % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBezierCurve.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBezierCurve.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBezierCurve.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawBezierCurve(points, varargin) %DRAWBEZIERCURVE Draw a cubic bezier curve defined by 4 control points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBox.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBox.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBox.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawBox(box, varargin) %DRAWBOX Draw a box defined by coordinate extents % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCenteredEdge.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCenteredEdge.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCenteredEdge.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawCenteredEdge(center, len, theta, varargin) %DRAWCENTEREDEDGE Draw an edge centered on a point % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCircle.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCircle.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCircle.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawCircle(varargin) %DRAWCIRCLE Draw a circle on the current axis % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCircleArc.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCircleArc.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCircleArc.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawCircleArc(varargin) %DRAWCIRCLEARC Draw a circle arc on the current axis % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEdge.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEdge.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEdge.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawEdge(varargin) %DRAWEDGE Draw an edge given by 2 points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEllipse.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEllipse.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEllipse.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawEllipse(varargin) %DRAWELLIPSE Draw an ellipse on the current axis % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEllipseArc.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEllipseArc.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEllipseArc.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawEllipseArc(varargin) %DRAWELLIPSEARC Draw an ellipse arc on the current axis % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLabels.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLabels.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLabels.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawLabels(varargin) %DRAWLABELS Draw labels at specified positions % @@ -73,4 +83,4 @@ if nargout>0 varargout{1}=h; -end \ No newline at end of file +end Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLine.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLine.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawLine(lin, varargin) %DRAWLINE Draw the line on the current axis % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawOrientedBox.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawOrientedBox.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawOrientedBox.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawOrientedBox(box, varargin) %DRAWORIENTEDBOX Draw centered oriented rectangle % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawParabola.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawParabola.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawParabola.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawParabola(varargin) %DRAWPARABOLA Draw a parabola on the current axis % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawPoint(varargin) %DRAWPOINT Draw the point on the axis. % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRay.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRay.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRay.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% Copyright (c) 2010, David Legland <dav...@gr...> +%% +%% All rights reserved. +%% +%% This program is free software; you can redistribute it and/or modify +%% it under the terms of the BSD License. For details see the COPYING +%% file included as part of this distribution. + +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> + function varargout = drawRay(ray, varargin) %DRAWRAY Draw a ray on the current axis % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRect.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRect.m 2011-10-03 19:56:05 UTC (rev 8663) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRect.m 2011-10-03 21:03:42 UTC (rev 8664) @@ -1,3 +1,13 @@ +%% C... [truncated message content] |
From: <jpi...@us...> - 2011-10-03 21:52:57
|
Revision: 8665 http://octave.svn.sourceforge.net/octave/?rev=8665&view=rev Author: jpicarbajal Date: 2011-10-03 21:52:47 +0000 (Mon, 03 Oct 2011) Log Message: ----------- geomtry. Full bsd header Modified Paths: -------------- trunk/octave-forge/main/geometry/geom2d/angle2Points.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/Contents.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/bisector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/cartesianLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/changelog.txt trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleArcAsCurve.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleAsPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circles2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLineRect.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipPoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/crackPattern.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/crackPattern2.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createBasisTransform.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createDirectedCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createHomothecy.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLineReflection.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createMedian.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRotation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createScaling.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createTranslation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/deg2rad.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePointEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePointLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawArrow.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBezierCurve.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBox.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCenteredEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawCircleArc.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEllipse.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEllipseArc.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLabels.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawOrientedBox.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawParabola.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRect.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRect2.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawShape.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeLength.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgePosition.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeToLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edges2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/ellipseAsPolygon.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/ellipses2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/enclosingCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/fitAffineTransform2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/formatAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/hexagonalGrid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/homothecy.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/inCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/inertiaEllipse.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectBoxes.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectCircles.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectEdges.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLineCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLineEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLines.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/invertLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isCounterClockwise.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isLeftOriented.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isParallel.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPerpendicular.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointInEllipse.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineFit.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/linePosition.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineSymmetry.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lines2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/medianLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/mergeBoxes.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/midPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/minDistance.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/minDistancePoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalize.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/onCircle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/onEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/onLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/onRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/orthogonalLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/parallelLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/pointOnLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/points2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/polarPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/projPointOnLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rad2deg.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/radicalAxis.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/randomPointInBox.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rays2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/readme.txt trunk/octave-forge/main/geometry/matGeom_raw/geom2d/reverseEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/reverseLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rotateVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rotation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/scaling.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/squareGrid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transforms2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/translation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/triangleGrid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vecnorm.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorNorm.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectors2d.m Modified: trunk/octave-forge/main/geometry/geom2d/angle2Points.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/angle2Points.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/geom2d/angle2Points.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,86 +1,109 @@ -%% Copyright (c) 2007-2011, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - -%% -*- texinfo -*- -%% @deftypefn {Function File} {@var{alpha} =} angle2Points (@var{p1}, @var{p2}) -%% Compute horizontal angle between 2 points -%% -%% @var{p1} and @var{p2} are either [1x2] arrays, or [Nx2] arrays, in this case -%% @var{alpha} is a [Nx1] array. The angle computed is the horizontal angle of -%% the line (@var{p1},@var{p2}). -%% -%% Result is always given in radians, between 0 and 2*pi. -%% -%% @seealso{points2d, angles2d, angle3points, normalizeAngle, vectorAngle} -%% -%% @end deftypefn - -function theta = angle2Points(varargin) - - % process input arguments - if length(varargin)==2 - p1 = varargin{1}; - p2 = varargin{2}; - elseif length(varargin)==1 - var = varargin{1}; - p1 = var(1,:); - p2 = var(2,:); - end - - % ensure data have correct size - n1 = size(p1, 1); - n2 = size(p2, 1); - if n1~=n2 && min(n1, n2)>1 - error('angle2Points: wrong size for inputs'); - end - - % angle of line (P2 P1), between 0 and 2*pi. - dp = bsxfun(@minus, p2, p1); - theta = mod(atan2(dp(:,2), dp(:,1)) + 2*pi, 2*pi); - -endfunction - -%!test -%! % all points inside window, possibly touching edges -%! p1 = [0 0]; -%! p2 = [10 0]; -%! angle_ = angle2Points (p1, p2); -%! assert (angle_,0,1e-6); -%! angle_ = angle2Points (p2, p1); -%! assert (angle_,pi,1e-6); - - -%!test -%! % all points inside window, possibly touching edges -%! p1 = [0 0]; -%! p2 = [0 10]; -%! angle_ = angle2Points (p1, p2); -%! assert (pi/2, angle_,1e-6); -%! angle_ = angle2Points (p2, p1); -%! assert (3*pi/2, angle_,1e-6); - -%!test -%! % all points inside window, possibly touching edges -%! p1 = [0 0;0 0;0 0;0 0]; -%! p2 = [10 0;10 10;0 10;-10 10]; -%! angle_ = angle2Points (p1, p2); -%! assert (size (p1, 1), size (angle_, 1)); -%! res = [0;pi/4;pi/2;3*pi/4]; -%! assert (res, angle_, 1e-6); - -%!test -%! % all points inside window, possibly touching edges -%! p1 = [0 0]; -%! p2 = [10 0;10 10;0 10;-10 10]; -%! angle_ = angle2Points (p1, p2); -%! assert(size (p2, 1), size (angle_, 1)); -%! res = [0;pi/4;pi/2;3*pi/4]; -%! assert(res, angle_,1e-6); - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{alpha} =} angle2Points (@var{p1}, @var{p2}) +%% Compute horizontal angle between 2 points +%% +%% @var{p1} and @var{p2} are either [1x2] arrays, or [Nx2] arrays, in this case +%% @var{alpha} is a [Nx1] array. The angle computed is the horizontal angle of +%% the line (@var{p1},@var{p2}). +%% +%% Result is always given in radians, between 0 and 2*pi. +%% +%% @seealso{points2d, angles2d, angle3points, normalizeAngle, vectorAngle} +%% +%% @end deftypefn + +function theta = angle2Points(varargin) + + % process input arguments + if length(varargin)==2 + p1 = varargin{1}; + p2 = varargin{2}; + elseif length(varargin)==1 + var = varargin{1}; + p1 = var(1,:); + p2 = var(2,:); + end + + % ensure data have correct size + n1 = size(p1, 1); + n2 = size(p2, 1); + if n1~=n2 && min(n1, n2)>1 + error('angle2Points: wrong size for inputs'); + end + + % angle of line (P2 P1), between 0 and 2*pi. + dp = bsxfun(@minus, p2, p1); + theta = mod(atan2(dp(:,2), dp(:,1)) + 2*pi, 2*pi); + +endfunction + +%!test +%! % all points inside window, possibly touching edges +%! p1 = [0 0]; +%! p2 = [10 0]; +%! angle_ = angle2Points (p1, p2); +%! assert (angle_,0,1e-6); +%! angle_ = angle2Points (p2, p1); +%! assert (angle_,pi,1e-6); + + +%!test +%! % all points inside window, possibly touching edges +%! p1 = [0 0]; +%! p2 = [0 10]; +%! angle_ = angle2Points (p1, p2); +%! assert (pi/2, angle_,1e-6); +%! angle_ = angle2Points (p2, p1); +%! assert (3*pi/2, angle_,1e-6); + +%!test +%! % all points inside window, possibly touching edges +%! p1 = [0 0;0 0;0 0;0 0]; +%! p2 = [10 0;10 10;0 10;-10 10]; +%! angle_ = angle2Points (p1, p2); +%! assert (size (p1, 1), size (angle_, 1)); +%! res = [0;pi/4;pi/2;3*pi/4]; +%! assert (res, angle_, 1e-6); + +%!test +%! % all points inside window, possibly touching edges +%! p1 = [0 0]; +%! p2 = [10 0;10 10;0 10;-10 10]; +%! angle_ = angle2Points (p1, p2); +%! assert(size (p2, 1), size (angle_, 1)); +%! res = [0;pi/4;pi/2;3*pi/4]; +%! assert(res, angle_,1e-6); + Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/Contents.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/Contents.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/Contents.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + % GEOM2D Geometry 2D Toolbox % Version 1.0 21-Mar-2011 . % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function theta = angle3Points(varargin) %ANGLE3POINTS Compute oriented angle made by 3 points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function dif = angleAbsDiff(angle1, angle2) %ANGLEABSDIFF Absolute difference between two angles % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function dif = angleDiff(angle1, angle2) %ANGLEDIFF Difference between two angles % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function varargout = angleSort(pts, varargin) %ANGLESORT Sort points in the plane according to their angle to origin % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function angles2d %ANGLES2D Description of functions for manipulating angles % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/bisector.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/bisector.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/bisector.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function ray = bisector(varargin) %BISECTOR Return the bisector of two lines, or 3 points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function boxes2d(varargin) %BOXES2D Description of functions operating on bounding boxes % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/cartesianLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/cartesianLine.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/cartesianLine.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function line = cartesianLine(varargin) %CARTESIANLINE Create a straight line from cartesian equation coefficients % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function center = centroid(varargin) %CENTROID Compute centroid (center of mass) of a set of points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/changelog.txt =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/changelog.txt 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/changelog.txt 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + change log for geom2d geom2d, release 2011.??.?? Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleArcAsCurve.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleArcAsCurve.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleArcAsCurve.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function varargout = circleArcAsCurve(arc, N) %CIRCLEARCASCURVE Convert a circle arc into a series of points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleAsPolygon.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleAsPolygon.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circleAsPolygon.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function varargout = circleAsPolygon(circle, varargin) %CIRCLEASPOLYGON Convert a circle into a series of points % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circles2d.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circles2d.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/circles2d.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function circles2d(varargin) %CIRCLES2D Description of functions operating on circles % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function edge2 = clipEdge(edge, box) %CLIPEDGE Clip an edge with a rectangular box % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + + function edge = clipLine(line, box, varargin) %CLIPLINE Clip a line with a box % Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLineRect.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLineRect.m 2011-10-03 21:03:42 UTC (rev 8664) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLineRect.m 2011-10-03 21:52:47 UTC (rev 8665) @@ -1,13 +1,37 @@ -%% Copyright (c) 2010, David Legland <dav...@gr...> -%% -%% All rights reserved. -%% -%% This program is free software; you can redistribute it and/or modify -%% it under the terms of the BSD License. For details see the COPYING -%% file included as part of this distribution. - -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> - +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not ... [truncated message content] |
From: <jpi...@us...> - 2011-10-03 22:36:32
|
Revision: 8666 http://octave.svn.sourceforge.net/octave/?rev=8666&view=rev Author: jpicarbajal Date: 2011-10-03 22:36:21 +0000 (Mon, 03 Oct 2011) Log Message: ----------- geometry. Adapting Matgeom Modified Paths: -------------- trunk/octave-forge/main/geometry/geom2d/angle2Points.m Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/angle3Points.m trunk/octave-forge/main/geometry/geom2d/angleAbsDiff.m trunk/octave-forge/main/geometry/geom2d/normalizeAngle.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngle2Points.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngle3Points.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testNormalizeAngle.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/test_angleAbsDiff.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeAngle.m Modified: trunk/octave-forge/main/geometry/geom2d/angle2Points.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/angle2Points.m 2011-10-03 21:52:47 UTC (rev 8665) +++ trunk/octave-forge/main/geometry/geom2d/angle2Points.m 2011-10-03 22:36:21 UTC (rev 8666) @@ -42,7 +42,6 @@ %% Result is always given in radians, between 0 and 2*pi. %% %% @seealso{points2d, angles2d, angle3points, normalizeAngle, vectorAngle} -%% %% @end deftypefn function theta = angle2Points(varargin) Copied: trunk/octave-forge/main/geometry/geom2d/angle3Points.m (from rev 8665, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/angle3Points.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/angle3Points.m 2011-10-03 22:36:21 UTC (rev 8666) @@ -0,0 +1,82 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{alpha} =} angle3Points (@var{p1}, @var{p2}, @var{p3}) +%% Computes the angle between the points @var{p1}, @var{p2} and @var{p3}. +%% +%% @var{p1}, @var{p2} and @var{p3} are either [1x2] arrays, or [Nx2] arrays, in this case +%% @var{alpha} is a [Nx1] array. The angle computed is the directed angle between line +%% (@var{p2}@var{p1}) and line (@var{p2}@var{p3}). +%% +%% Result is always given in radians, between 0 and 2*pi. +%% +%% @seealso{points2d, angles2d, angle2points} +%% @end deftypefn + +function theta = angle3Points(varargin) + + if length(varargin)==3 + p1 = varargin{1}; + p2 = varargin{2}; + p3 = varargin{3}; + elseif length(varargin)==1 + var = varargin{1}; + p1 = var(1,:); + p2 = var(2,:); + p3 = var(3,:); + end + + % angle line (P2 P1) + theta = lineAngle(createLine(p2, p1), createLine(p2, p3)); + +endfunction + +%!test +%! % all points inside window, possibly touching edges +%! p1 = [10 0]; +%! p2 = [0 0]; +%! p3 = [0 10]; +%! angle_ = angle3Points(p1, p2, p3); +%! assert(pi/2, angle_,1e-6); +%! angle_ = angle3Points([p1; p2; p3]); +%! assert(pi/2, angle_, 1e-6); + +%!test +%! p1 = [10 0; 20 0]; +%! p2 = [0 0;0 0]; +%! p3 = [0 10; 0 20]; +%! angle_ = angle3Points(p1, p2, p3); +%! assert(2, size(angle_, 1)); +%! assert([pi/2;pi/2], angle_, 1e-6); + Copied: trunk/octave-forge/main/geometry/geom2d/angleAbsDiff.m (from rev 8665, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/angleAbsDiff.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/angleAbsDiff.m 2011-10-03 22:36:21 UTC (rev 8666) @@ -0,0 +1,66 @@ +%% Copyright (c) 2011, INRA +%% 2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{dif} =} angleAbsDiff (@var{angle1}, @var{angle2}) +%% Computes the absolute angular difference between two angles in radians. +%% The result is comprised between 0 and pi. +%% +%% @example +%% A = angleAbsDiff(pi/2, pi/3) +%% A = +%% 0.5236 % equal to pi/6 +%% @end example +%% +%% @seealso{angles2d, angleDiff} +%% @end deftypefn + +function dif = angleAbsDiff(angle1, angle2) + + % first, normalization + angle1 = normalizeAngle(angle1); + angle2 = normalizeAngle(angle2); + + % compute difference and normalize + dif = normalizeAngle(angle1 - angle2); + dif = min(dif, 2*pi - dif); + +endfunction + +%!shared xp +%! xp = pi/2; +%!assert (xp, angleAbsDiff (pi/2, 0), 1e-6); +%!assert (xp, angleAbsDiff (0, pi/2), 1e-6); +%!assert (xp, angleAbsDiff (0, 3*pi/2), 1e-6); +%!assert (xp, angleAbsDiff (3*pi/2, 0), 1e-6); + Copied: trunk/octave-forge/main/geometry/geom2d/normalizeAngle.m (from rev 8665, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeAngle.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/normalizeAngle.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/normalizeAngle.m 2011-10-03 22:36:21 UTC (rev 8666) @@ -0,0 +1,96 @@ +%% Copyright (c) 2011, INRA +%% 2008-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{alpha2} =} normalizeAngle (@var{alpha}) +%% @deftypefnx {Function File} {@var{alpha2} =} normalizeAngle (@var{alpha}, @var{center}) +%% NORMALIZEANGLE Normalize an angle value within a 2*PI interval +%% +%% ALPHA2 = normalizeAngle(ALPHA); +%% ALPHA2 is the same as ALPHA modulo 2*PI and is positive. +%% +%% ALPHA2 = normalizeAngle(ALPHA, CENTER); +%% Specifies the center of the angle interval. +%% If CENTER==0, the interval is [-pi ; +pi] +%% If CENTER==PI, the interval is [0 ; 2*pi] (default). +%% +%% Example: +%% % normalization between 0 and 2*pi (default) +%% normalizeAngle(5*pi) +%% ans = +%% 3.1416 +%% +%% % normalization between -pi and +pi +%% normalizeAngle(7*pi/2, 0) +%% ans = +%% -1.5708 +%% +%% References +%% Follows the same convention as apache commons library, see: +%% http://commons.apache.org/math/api-2.2/org/apache/commons/math/util/MathUtils.html%% +%% +%% @seealso{vectorAngle, lineAngle} +%% @end deftypefn + +function alpha = normalizeAngle(alpha, varargin) + + center = pi; + if ~isempty(varargin) + center = varargin{1}; + end + + alpha = mod(alpha-center+pi, 2*pi) + center-pi; + +endfunction + +%!assert (pi/2, normalizeAngle (pi/2), 1e-6); +%!assert (pi, normalizeAngle (pi), 1e-6); +%!assert (3*pi/2, normalizeAngle (3*pi/2), 1e-6); +%!assert (pi/2, normalizeAngle (pi/2, pi), 1e-6); +%!assert (pi, normalizeAngle (pi, pi), 1e-6); +%!assert (3*pi/2, normalizeAngle (3*pi/2, pi), 1e-6); + +%!test +%! theta = linspace(0, 2*pi-.1, 100); +%! assert(theta, normalizeAngle (theta), 1e-6); + +%!assert (0, normalizeAngle (0, 0), 1e-6); +%!assert (pi/2, normalizeAngle (pi/2, 0), 1e-6); +%!assert (-pi, normalizeAngle (-pi, 0), 1e-6); +%!assert (-pi/2, normalizeAngle (7*pi/2, 0), 1e-6); + +%!test +%! theta = linspace(-pi+.1, pi-.1, 100); +%! assert(theta, normalizeAngle (theta, 0), 1e-6); + + Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngle2Points.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngle2Points.m 2011-10-03 21:52:47 UTC (rev 8665) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngle2Points.m 2011-10-03 22:36:21 UTC (rev 8666) @@ -1,63 +0,0 @@ -function test_suite = testAngle2Points(varargin) -%TESTCLIPLINE One-line description here, please. -% output = testAngle2Points(input) -% -% Example -% testAngle2Points -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. - -initTestSuite; - -function testHoriz -% all points inside window, possibly touching edges - -p1 = [0 0]; -p2 = [10 0]; -angle = angle2Points(p1, p2); -assertAlmostEqual(0, angle); - -angle = angle2Points(p2, p1); -assertAlmostEqual(pi, angle); - -function testVert -% all points inside window, possibly touching edges - -p1 = [0 0]; -p2 = [0 10]; -angle = angle2Points(p1, p2); -assertAlmostEqual(pi/2, angle); - -angle = angle2Points(p2, p1); -assertAlmostEqual(3*pi/2, angle); - - -function testMultiMulti -% all points inside window, possibly touching edges - -p1 = [0 0;0 0;0 0;0 0]; -p2 = [10 0;10 10;0 10;-10 10]; -angle = angle2Points(p1, p2); -assertEqual(size(p1, 1), size(angle, 1)); - -res = [0;pi/4;pi/2;3*pi/4]; -assertElementsAlmostEqual(res, angle); - -function testOneMulti -% all points inside window, possibly touching edges - -p1 = [0 0]; -p2 = [10 0;10 10;0 10;-10 10]; -angle = angle2Points(p1, p2); -assertEqual(size(p2, 1), size(angle, 1)); - -res = [0;pi/4;pi/2;3*pi/4]; -assertElementsAlmostEqual(res, angle); - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngle3Points.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngle3Points.m 2011-10-03 21:52:47 UTC (rev 8665) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngle3Points.m 2011-10-03 22:36:21 UTC (rev 8666) @@ -1,48 +0,0 @@ -function test_suite = testAngle3Points(varargin) -% One-line description here, please. -% output = testAngle3Points(input) -% -% Example -% testAngle3Points -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. - -initTestSuite; - -function testSimple -% all points inside window, possibly touching edges - -p1 = [10 0]; -p2 = [0 0]; -p3 = [0 10]; -angle = angle3Points(p1, p2, p3); -assertAlmostEqual(pi/2, angle); - - -function testBundledInput -% all points inside window, possibly touching edges - -p1 = [10 0]; -p2 = [0 0]; -p3 = [0 10]; -angle = angle3Points([p1; p2; p3]); -assertAlmostEqual(pi/2, angle); - -function testArray -% all points inside window, possibly touching edges - -p1 = [10 0; 20 0]; -p2 = [0 0;0 0]; -p3 = [0 10; 0 20]; -angle = angle3Points(p1, p2, p3); - -assertEqual(2, size(angle, 1)); -assertElementsAlmostEqual([pi/2;pi/2], angle); - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testNormalizeAngle.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testNormalizeAngle.m 2011-10-03 21:52:47 UTC (rev 8665) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testNormalizeAngle.m 2011-10-03 22:36:21 UTC (rev 8666) @@ -1,67 +0,0 @@ -function test_suite = testNormalizeAngle(varargin) -% One-line description here, please. -% output = testNormalizeAngle(input) -% -% Example -% testAngle2Points -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. - -initTestSuite; - -function testDefault - -theta = pi/2; -assertAlmostEqual(theta, normalizeAngle(theta)); - -theta = pi; -assertAlmostEqual(theta, normalizeAngle(theta)); - -theta = 3*pi/2; -assertAlmostEqual(theta, normalizeAngle(theta)); - -function testPiCentered - -theta = pi/2; -assertAlmostEqual(theta, normalizeAngle(theta, pi)); - -theta = pi; -assertAlmostEqual(theta, normalizeAngle(theta, pi)); - -theta = 3*pi/2; -assertAlmostEqual(theta, normalizeAngle(theta, pi)); - - -function testVector - -theta = linspace(0, 2*pi-.1, 100); -assertElementsAlmostEqual(theta, normalizeAngle(theta)); - - -function testZeroCentered - -theta = 0; -assertAlmostEqual(theta, normalizeAngle(theta, 0)); - -theta = pi/2; -assertAlmostEqual(theta, normalizeAngle(theta, 0)); - -theta = -pi; -assertAlmostEqual(theta, normalizeAngle(theta, 0)); - -theta = 7*pi/2; -assertAlmostEqual(-pi/2, normalizeAngle(theta, 0)); - -function testVectorZeroCentered - -theta = linspace(-pi+.1, pi-.1, 100); -assertElementsAlmostEqual(theta, normalizeAngle(theta, 0)); - - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/test_angleAbsDiff.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/test_angleAbsDiff.m 2011-10-03 21:52:47 UTC (rev 8665) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/test_angleAbsDiff.m 2011-10-03 22:36:21 UTC (rev 8666) @@ -1,35 +0,0 @@ -function test_suite = test_angleAbsDiff(varargin) %#ok<STOUT> -%TEST_ANGLEABSDIFF Test case for the file angleAbsDiff -% -% Test case for the file angleDiff - -% Example -% test_angleAbsDiff -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2011-07-27, using Matlab 7.9.0.529 (R2009b) -% Copyright 2011 INRA - Cepia Software Platform. - -initTestSuite; - -function test_Simple %#ok<*DEFNU> -% simple tests - -exp = pi/2; - -dif = angleAbsDiff(pi/2, 0); -assertAlmostEqual(exp, dif); - -dif = angleAbsDiff(0, pi/2); -assertAlmostEqual(exp, dif); - -dif = angleAbsDiff(0, 3*pi/2); -assertAlmostEqual(exp, dif); - -dif = angleAbsDiff(3*pi/2, 0); -assertAlmostEqual(exp, dif); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m 2011-10-03 21:52:47 UTC (rev 8665) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angle3Points.m 2011-10-03 22:36:21 UTC (rev 8666) @@ -1,72 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function theta = angle3Points(varargin) -%ANGLE3POINTS Compute oriented angle made by 3 points -% -% ALPHA = angle3Points(P1, P2, P3); -% Computes the angle between the points P1, P2 and P3. -% Pi are either [1*2] arrays, or [N*2] arrays, in this case ALPHA is a -% [N*1] array. The angle computed is the directed angle between line -% (P2P1) and line (P2P3). -% Result is always given in radians, between 0 and 2*pi. -% -% See Also: -% points2d, angles2d, angle2points -% -% -% --------- -% Author: David Legland -% e-mail: dav...@gr... -% created the 23/02/2004. -% Copyright 2010 INRA - Cepia Software Platform. - - -% HISTORY : -% 25/09/2005 : enable single parameter - -if length(varargin)==3 - p1 = varargin{1}; - p2 = varargin{2}; - p3 = varargin{3}; -elseif length(varargin)==1 - var = varargin{1}; - p1 = var(1,:); - p2 = var(2,:); - p3 = var(3,:); -end - -% angle line (P2 P1) -theta = lineAngle(createLine(p2, p1), createLine(p2, p3)); - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m 2011-10-03 21:52:47 UTC (rev 8665) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleAbsDiff.m 2011-10-03 22:36:21 UTC (rev 8666) @@ -1,62 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function dif = angleAbsDiff(angle1, angle2) -%ANGLEABSDIFF Absolute difference between two angles -% -% AD = angleAbsDiff(ANGLE1, ANGLE2) -% Computes the absolute angular difference between two angles in radians. -% The result is comprised between 0 and PI. -% -% Example -% A = angleAbsDiff(pi/2, pi/3) -% A = -% 0.5236 % equal to pi/6 -% -% See also -% angles2d, angleDiff -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2011-07-27, using Matlab 7.9.0.529 (R2009b) -% Copyright 2011 INRA - Cepia Software Platform. - -% first, normalization -angle1 = normalizeAngle(angle1); -angle2 = normalizeAngle(angle2); - -% compute difference and normalize -dif = normalizeAngle(angle1 - angle2); -dif = min(dif, 2*pi - dif); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeAngle.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeAngle.m 2011-10-03 21:52:47 UTC (rev 8665) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeAngle.m 2011-10-03 22:36:21 UTC (rev 8666) @@ -1,79 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function alpha = normalizeAngle(alpha, varargin) -%NORMALIZEANGLE Normalize an angle value within a 2*PI interval -% -% ALPHA2 = normalizeAngle(ALPHA); -% ALPHA2 is the same as ALPHA modulo 2*PI and is positive. -% -% ALPHA2 = normalizeAngle(ALPHA, CENTER); -% Specifies the center of the angle interval. -% If CENTER==0, the interval is [-pi ; +pi] -% If CENTER==PI, the interval is [0 ; 2*pi] (default). -% -% Example: -% % normalization between 0 and 2*pi (default) -% normalizeAngle(5*pi) -% ans = -% 3.1416 -% -% % normalization between -pi and +pi -% normalizeAngle(7*pi/2, 0) -% ans = -% -1.5708 -% -% See also -% vectorAngle, lineAngle -% -% References -% Follows the same convention as apache commons library, see: -% http://commons.apache.org/math/api-2.2/org/apache/commons/math/util/MathUtils.html -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2008-03-10, using Matlab 7.4.0.287 (R2007a) -% Copyright 2008 INRA - BIA PV Nantes - MIAJ Jouy-en-Josas. - -% HISTORY -% 2010-03-31 rename as normalizeAngle, and add psb to specify interval -% center - -center = pi; -if ~isempty(varargin) - center = varargin{1}; -end - -alpha = mod(alpha-center+pi, 2*pi) + center-pi; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-03 23:11:18
|
Revision: 8667 http://octave.svn.sourceforge.net/octave/?rev=8667&view=rev Author: jpicarbajal Date: 2011-10-03 23:11:11 +0000 (Mon, 03 Oct 2011) Log Message: ----------- geometry. Adapting matGeom Modified Paths: -------------- trunk/octave-forge/main/geometry/geom2d/angle2Points.m Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/vectorAngle.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testVectorAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorAngle.m Modified: trunk/octave-forge/main/geometry/geom2d/angle2Points.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/angle2Points.m 2011-10-03 22:36:21 UTC (rev 8666) +++ trunk/octave-forge/main/geometry/geom2d/angle2Points.m 2011-10-03 23:11:11 UTC (rev 8667) @@ -106,3 +106,4 @@ %! res = [0;pi/4;pi/2;3*pi/4]; %! assert(res, angle_,1e-6); + Copied: trunk/octave-forge/main/geometry/geom2d/vectorAngle.m (from rev 8665, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorAngle.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/vectorAngle.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/vectorAngle.m 2011-10-03 23:11:11 UTC (rev 8667) @@ -0,0 +1,221 @@ +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{alpha} =} vectorAngle (@var{v1}) +%%VECTORANGLE Angle of a vector, or between 2 vectors +%% +%% A = vectorAngle(V); +%% Returns angle between Ox axis and vector direction, in Counter +%% clockwise orientation. +%% The result is normalised between 0 and 2*PI. +%% +%% A = vectorAngle(V1, V2); +%% Returns the angle from vector V1 to vector V2, in counter-clockwise +%% order, and in radians. +%% +%% A = vectorAngle(..., 'cutAngle', CUTANGLE); +%% A = vectorAngle(..., CUTANGLE); % (deprecated syntax) +%% Specifies convention for angle interval. CUTANGLE is the center of the +%% 2*PI interval containing the result. See <a href="matlab:doc +%% ('normalizeAngle')">normalizeAngle</a> for details. +%% +%% Example: +%% rad2deg(vectorAngle([2 2])) +%% ans = +%% 45 +%% rad2deg(vectorAngle([1 sqrt(3)])) +%% ans = +%% 60 +%% rad2deg(vectorAngle([0 -1])) +%% ans = +%% 270 +%% +%% @seealso{vectors2d, angles2d, normalizeAngle} +%% @end deftypefn + +function alpha = vectorAngle(v1, varargin) + + %% Initializations + + % default values + v2 = []; + cutAngle = pi; + + % process input arguments + while ~isempty(varargin) + var = varargin{1}; + if isnumeric(var) && isscalar(var) + % argument is normalization constant + cutAngle = varargin{1}; + varargin(1) = []; + + elseif isnumeric(var) && size(var, 2) == 2 + % argument is second vector + v2 = varargin{1}; + varargin(1) = []; + + elseif ischar(var) && length(varargin) >= 2 + % argument is option given as string + value + if strcmpi(var, 'cutAngle') + cutAngle = varargin{2}; + varargin(1:2) = []; + + else + error(['Unknown option: ' var]); + end + + else + error('Unable to parse inputs'); + end + end + + + %% Case of one vector + + % If only one vector is provided, computes its angle + if isempty(v2) + % compute angle and format result in a 2*pi interval + alpha = atan2(v1(:,2), v1(:,1)); + + % normalize within a 2*pi interval + alpha = normalizeAngle(alpha + 2*pi, cutAngle); + + return; + end + + + %% Case of two vectors + + % compute angle of each vector + alpha1 = atan2(v1(:,2), v1(:,1)); + alpha2 = atan2(v2(:,2), v2(:,1)); + + % difference + alpha = bsxfun(@minus, alpha2, alpha1); + + % normalize within a 2*pi interval + alpha = normalizeAngle(alpha + 2*pi, cutAngle); + +endfunction + +%!test +%! ang = vectorAngle([1 0]); +%! assert(0, ang, 1e-6); + +%!test +%! ang = vectorAngle([0 1]); +%! assert(pi/2, ang, 1e-6); + +%!test +%! ang = vectorAngle([-1 0]); +%! assert(pi, ang, 1e-6); + +%!test +%! ang = vectorAngle([0 -1]); +%! assert(3*pi/2, ang, 1e-6); + +%!test +%! ang = vectorAngle([-1 1]); +%! assert(3*pi/4, ang, 1e-6); + +%!test +%! ang = vectorAngle([1 0], pi); +%! assert(0, ang, 1e-6); + +%!test +%! ang = vectorAngle([0 1], pi); +%! assert(pi/2, ang, 1e-6); + +%!test +%! ang = vectorAngle([-1 0], pi); +%! assert(pi, ang, 1e-6); + +%!test +%! ang = vectorAngle([0 -1], pi); +%! assert(3*pi/2, ang, 1e-6); + +%!test +%! ang = vectorAngle([-1 1], pi); +%! assert(3*pi/4, ang, 1e-6); + +%!test +%! vecs = [1 0;0 1;-1 0;0 -1;1 1]; +%! angs = [0;pi/2;pi;3*pi/2;pi/4]; +%! assert(angs, vectorAngle(vecs)); +%! assert(angs, vectorAngle(vecs, pi)); + +%!test +%! ang = vectorAngle([1 0], 0); +%! assert(0, ang, 1e-6); + +%!test +%! ang = vectorAngle([0 1], 0); +%! assert(pi/2, ang, 1e-6); + +%!test +%! ang = vectorAngle([0 -1], 0); +%! assert(-pi/2, ang, 1e-6); + +%!test +%! ang = vectorAngle([-1 1], 0); +%! assert(3*pi/4, ang, 1e-6); + +%!test +%! vecs = [1 0;0 1;0 -1;1 1;1 -1]; +%! angs = [0;pi/2;-pi/2;pi/4;-pi/4]; +%! assert(angs, vectorAngle(vecs, 0)); + +%!test +%! v1 = [1 0]; +%! v2 = [0 1]; +%! ang = pi /2 ; +%! assert(ang, vectorAngle(v1, v2)); + +%!test +%! v1 = [1 0]; +%! v2 = [0 1; 0 1; 1 1; -1 1]; +%! ang = [pi / 2 ;pi / 2 ;pi / 4 ; 3 * pi / 4]; +%! assert(ang, vectorAngle(v1, v2)); + +%!test +%! v1 = [0 1; 0 1; 1 1; -1 1]; +%! v2 = [-1 0]; +%! ang = [pi / 2 ;pi / 2 ; 3 * pi / 4 ; pi / 4]; +%! assert(ang, vectorAngle(v1, v2)); + +%!test +%! v1 = [1 0; 0 1; 1 1; -1 1]; +%! v2 = [0 1; 1 0; -1 1; -1 0]; +%! ang = [pi / 2 ;3 * pi / 2 ;pi / 2 ; pi / 4]; +%! assert(ang, vectorAngle(v1, v2)); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testVectorAngle.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testVectorAngle.m 2011-10-03 22:36:21 UTC (rev 8666) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testVectorAngle.m 2011-10-03 23:11:11 UTC (rev 8667) @@ -1,114 +0,0 @@ -function test_suite = testVectorAngle(varargin) %#ok<STOUT> -% One-line description here, please. -% output = testVectorAngle(input) -% -% Example -% testVectorAngle -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. - -initTestSuite; - -function testSingle %#ok<*DEFNU> - -ang = vectorAngle([1 0]); -assertAlmostEqual(0, ang); - -ang = vectorAngle([0 1]); -assertAlmostEqual(pi/2, ang); - -ang = vectorAngle([-1 0]); -assertAlmostEqual(pi, ang); - -ang = vectorAngle([0 -1]); -assertAlmostEqual(3*pi/2, ang); - -ang = vectorAngle([-1 1]); -assertAlmostEqual(3*pi/4, ang); - -function testSinglePiCentered - -ang = vectorAngle([1 0], pi); -assertAlmostEqual(0, ang); - -ang = vectorAngle([0 1], pi); -assertAlmostEqual(pi/2, ang); - -ang = vectorAngle([-1 0], pi); -assertAlmostEqual(pi, ang); - -ang = vectorAngle([0 -1], pi); -assertAlmostEqual(3*pi/2, ang); - -ang = vectorAngle([-1 1], pi); -assertAlmostEqual(3*pi/4, ang); - - -function testArray - -vecs = [1 0;0 1;-1 0;0 -1;1 1]; -angs = [0;pi/2;pi;3*pi/2;pi/4]; -assertElementsAlmostEqual(angs, vectorAngle(vecs)); - -function testArrayPiCentered - -vecs = [1 0;0 1;-1 0;0 -1;1 1]; -angs = [0;pi/2;pi;3*pi/2;pi/4]; -assertElementsAlmostEqual(angs, vectorAngle(vecs, pi)); - -function testSingleZeroCentered - -ang = vectorAngle([1 0], 0); -assertAlmostEqual(0, ang); - -ang = vectorAngle([0 1], 0); -assertAlmostEqual(pi/2, ang); - -ang = vectorAngle([0 -1], 0); -assertAlmostEqual(-pi/2, ang); - -ang = vectorAngle([-1 1], 0); -assertAlmostEqual(3*pi/4, ang); - -function testArrayZeroCentered - -vecs = [1 0;0 1;0 -1;1 1;1 -1]; -angs = [0;pi/2;-pi/2;pi/4;-pi/4]; -assertElementsAlmostEqual(angs, vectorAngle(vecs, 0)); - -function testCoupleSingleSingle - -v1 = [1 0]; -v2 = [0 1]; -ang = pi /2 ; -assertElementsAlmostEqual(ang, vectorAngle(v1, v2)); - -function testCoupleSingleArray - -v1 = [1 0]; -v2 = [0 1; 0 1; 1 1; -1 1]; -ang = [pi / 2 ;pi / 2 ;pi / 4 ; 3 * pi / 4]; -assertElementsAlmostEqual(ang, vectorAngle(v1, v2)); - - -function testCoupleArraySingle - -v1 = [0 1; 0 1; 1 1; -1 1]; -v2 = [-1 0]; -ang = [pi / 2 ;pi / 2 ; 3 * pi / 4 ; pi / 4]; -assertElementsAlmostEqual(ang, vectorAngle(v1, v2)); - - -function testCoupleArrayArray - -v1 = [1 0; 0 1; 1 1; -1 1]; -v2 = [0 1; 1 0; -1 1; -1 0]; -ang = [pi / 2 ;3 * pi / 2 ;pi / 2 ; pi / 4]; -assertElementsAlmostEqual(ang, vectorAngle(v1, v2)); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorAngle.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorAngle.m 2011-10-03 22:36:21 UTC (rev 8666) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorAngle.m 2011-10-03 23:11:11 UTC (rev 8667) @@ -1,138 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function alpha = vectorAngle(v1, varargin) -%VECTORANGLE Angle of a vector, or between 2 vectors -% -% A = vectorAngle(V); -% Returns angle between Ox axis and vector direction, in Counter -% clockwise orientation. -% The result is normalised between 0 and 2*PI. -% -% A = vectorAngle(V1, V2); -% Returns the angle from vector V1 to vector V2, in counter-clockwise -% order, and in radians. -% -% A = vectorAngle(..., 'cutAngle', CUTANGLE); -% A = vectorAngle(..., CUTANGLE); % (deprecated syntax) -% Specifies convention for angle interval. CUTANGLE is the center of the -% 2*PI interval containing the result. See <a href="matlab:doc -% ('normalizeAngle')">normalizeAngle</a> for details. -% -% Example: -% rad2deg(vectorAngle([2 2])) -% ans = -% 45 -% rad2deg(vectorAngle([1 sqrt(3)])) -% ans = -% 60 -% rad2deg(vectorAngle([0 -1])) -% ans = -% 270 -% -% See also: -% vectors2d, angles2d, normalizeAngle -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2007-10-18 -% Copyright 2011 INRA - Cepia Software Platform. - -% HISTORY -% 2010-04-16 add psb to specify center interval -% 2011-04-10 add support for angle between two vectors - - -%% Initializations - -% default values -v2 = []; -cutAngle = pi; - -% process input arguments -while ~isempty(varargin) - var = varargin{1}; - if isnumeric(var) && isscalar(var) - % argument is normalization constant - cutAngle = varargin{1}; - varargin(1) = []; - - elseif isnumeric(var) && size(var, 2) == 2 - % argument is second vector - v2 = varargin{1}; - varargin(1) = []; - - elseif ischar(var) && length(varargin) >= 2 - % argument is option given as string + value - if strcmpi(var, 'cutAngle') - cutAngle = varargin{2}; - varargin(1:2) = []; - - else - error(['Unknown option: ' var]); - end - - else - error('Unable to parse inputs'); - end -end - - -%% Case of one vector - -% If only one vector is provided, computes its angle -if isempty(v2) - % compute angle and format result in a 2*pi interval - alpha = atan2(v1(:,2), v1(:,1)); - - % normalize within a 2*pi interval - alpha = normalizeAngle(alpha + 2*pi, cutAngle); - - return; -end - - -%% Case of two vectors - -% compute angle of each vector -alpha1 = atan2(v1(:,2), v1(:,1)); -alpha2 = atan2(v2(:,2), v2(:,1)); - -% difference -alpha = bsxfun(@minus, alpha2, alpha1); - -% normalize within a 2*pi interval -alpha = normalizeAngle(alpha + 2*pi, cutAngle); - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-04 00:06:40
|
Revision: 8670 http://octave.svn.sourceforge.net/octave/?rev=8670&view=rev Author: jpicarbajal Date: 2011-10-04 00:06:32 +0000 (Tue, 04 Oct 2011) Log Message: ----------- geometry. Adapting matGeom - angles Done! Modified Paths: -------------- trunk/octave-forge/main/geometry/geom2d/inst/vectorAngle.m Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/inst/angleDiff.m trunk/octave-forge/main/geometry/geom2d/inst/angleSort.m trunk/octave-forge/main/geometry/geom2d/inst/angles2d.m trunk/octave-forge/main/geometry/geom2d/inst/createLine.m trunk/octave-forge/main/geometry/geom2d/inst/deg2rad.m trunk/octave-forge/main/geometry/geom2d/inst/edgeAngle.m trunk/octave-forge/main/geometry/geom2d/inst/lineAngle.m trunk/octave-forge/main/geometry/geom2d/inst/rad2deg.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngleSort.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateLine.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testLineAngle.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/test_angleDiff.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/deg2rad.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineAngle.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rad2deg.m Copied: trunk/octave-forge/main/geometry/geom2d/inst/angleDiff.m (from rev 8665, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/angleDiff.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/angleDiff.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -0,0 +1,76 @@ +%% Copyright (c) 2011, INRA +%% 2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{dif} =} angleDiff (@var{angle1}, @var{angle2}) +%% ANGLEDIFF Difference between two angles +%% +%% Computes the signed angular difference between two angles in radians. +%% The result is comprised between -PI and +PI. +%% +%% Example +%% A = angleDiff(-pi/4, pi/4) +%% A = +%% 1.5708 % equal to pi/2 +%% A = angleDiff(pi/4, -pi/4) +%% A = +%% -1.5708 % equal to -pi/2 +%% +%% @seealso{angles2d, angleAbsDiff} +%% @end deftypefn + +function dif = angleDiff(angle1, angle2) + + % first, normalization + angle1 = normalizeAngle(angle1); + angle2 = normalizeAngle(angle2); + + % compute difference and normalize in [-pi pi] + dif = normalizeAngle(angle2 - angle1, 0); +endfunction + +%!test +%! dif = angleDiff(0, pi/2); +%! assert (pi/2, dif, 1e-6); + +%!test +%! dif = angleDiff(pi/2, 0); +%! assert (-pi/2, dif, 1e-6); + +%!test +%! dif = angleDiff(0, 3*pi/2); +%! assert (-pi/2, dif, 1e-6); + +%!test +%! dif = angleDiff(3*pi/2, 0); +%! assert (pi/2, dif, 1e-6); Copied: trunk/octave-forge/main/geometry/geom2d/inst/angleSort.m (from rev 8665, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/angleSort.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/angleSort.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -0,0 +1,106 @@ +%% Copyright (c) 2011, INRA +%% 2005-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {varargout =} angleSort (@var{pts}, varargin) +%% ANGLESORT Sort points in the plane according to their angle to origin +%% +%% +%% PTS2 = angleSort(PTS); +%% Computes angle of points with origin, and sort points with increasing +%% angles in Counter-Clockwise direction. +%% +%% PTS2 = angleSort(PTS, PTS0); +%% Computes angles between each point of PTS and PT0, which can be +%% different from origin. +%% +%% PTS2 = angleSort(..., THETA0); +%% Specifies the starting angle for sorting. +%% +%% [PTS2, I] = angleSort(...); +%% Also returns in I the indices of PTS, such that PTS2 = PTS(I, :); +%% +%% @seealso{points2d, angles2d, angle2points, normalizeAngle} +%% @end deftypefn + +function varargout = angleSort(pts, varargin) + + % default values + pt0 = [0 0]; + theta0 = 0; + + if length(varargin)==1 + var = varargin{1}; + if size(var, 2)==1 + % specify angle + theta0 = var; + else + pt0 = var; + end + elseif length(varargin)==2 + pt0 = varargin{1}; + theta0 = varargin{2}; + end + + + n = size(pts, 1); + pts2 = pts - repmat(pt0, [n 1]); + angle = lineAngle([zeros(n, 2) pts2]); + angle = mod(angle - theta0 + 2*pi, 2*pi); + + [dummy, I] = sort(angle); + + % format output + if nargout<2 + varargout{1} = pts(I, :); + elseif nargout==2 + varargout{1} = pts(I, :); + varargout{2} = I; + end + +endfunction + +%!shared p1,p2,p3,p4,pts,center +%! p1 = [0 0]; +%! p2 = [10 0]; +%! p3 = [10 10]; +%! p4 = [0 10]; +%! pts = [p1;p2;p3;p4]; +%! center = [5 5]; + +%!test +%! expected = pts([3 4 1 2], :); +%! assert (expected, angleSort (pts, center), 1e-6); + +%!assert (pts, angleSort (pts, center, -pi), 1e-6); + Copied: trunk/octave-forge/main/geometry/geom2d/inst/angles2d.m (from rev 8665, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/angles2d.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/angles2d.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -0,0 +1,54 @@ +%% Copyright (c) 2011, INRA +%% 2010-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} angles2d () +%% ANGLES2D Description of functions for manipulating angles +%% +%% Angles are normalized in an interval of width 2*PI. Most geom2d +%% functions return results in the [0 2*pi] interval, but it can be +%% convenient to consider the [-pi pi] interval as well. See the +%% normalizeAngle function to switch between conventions. +%% +%% Angles are usually oriented. The default orientation is the CCW +%% (Counter-Clockwise) orientation. +%% +%% @seealso{angle2Points, angle3Points, angleAbsDiff, normalizeAngle, vectorAngle, +%% angleDiff, angleSort, lineAngle, edgeAngle, deg2rad, rad2deg} +%% @end deftypefn + +function angles2d + + help('angles2d'); + +endfunction Copied: trunk/octave-forge/main/geometry/geom2d/inst/createLine.m (from rev 8665, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLine.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/createLine.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/createLine.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -0,0 +1,163 @@ +%% Copyright (c) 2011, INRA +%% 2003-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{line} =} createLine(varargin) +%% CREATELINE Create a straight line from 2 points, or from other inputs +%% +%% Line is represented in a parametric form : [x0 y0 dx dy] +%% x = x0 + t*dx +%% y = y0 + t*dy; +%% +%% +%% L = createLine(p1, p2); +%% Returns the line going through the two given points. +%% +%% L = createLine(x0, y0, dx, dy); +%% Returns the line going through point (x0, y0) and with direction +%% vector(dx, dy). +%% +%% L = createLine(LINE); +%% where LINE is an array of 4 values, creates the line going through the +%% point (LINE(1) LINE(2)), and with direction given by vector (LINE(3) +%% LINE(4)). +%% +%% L = createLine(THETA); +%% Create a polar line originated at (0,0) and with angle THETA. +%% +%% L = createLine(RHO, THETA); +%% Create a polar line with normal theta, and with min distance to origin +%% equal to rho. rho can be negative, in this case, the line is the same +%% as with CREATELINE(-rho, theta+pi), but the orientation is different. +%% +%% +%% Note: in all cases, parameters can be vertical arrays of the same +%% dimension. The result is then an array of lines, of dimensions [N*4]. +%% +%% NOTE : A line can also be represented with a 1*5 array : +%% [x0 y0 dx dy t]. +%% whith 't' being one of the following : +%% - t=0 : line is a singleton (x0,y0) +%% - t=1 : line is an edge segment, between points (x0,y0) and (x0+dx, +%% y0+dy). +%% - t=Inf : line is a Ray, originated from (x0,y0) and going to infinity +%% in the direction(dx,dy). +%% - t=-Inf : line is a Ray, originated from (x0,y0) and going to infinity +%% in the direction(-dx,-dy). +%% - t=NaN : line is a real straight line, and contains all points +%% verifying the above equation. +%% This seems us a convenient way to represent uniformly all kind of lines +%% (including edges, rays, and even point). +%% +%% NOTE2 : Any line object can be represented using a 1x6 array : +%% [x0 y0 dx dy t0 t1] +%% the first 4 parameters define the supporting line, +%% t0 represent the position of the first point on the line, +%% and t1 the position of the last point. +%% * for edges : t0 = 0, and t1=1 +%% * for straight lines : t0 = -inf, t1=inf +%% * for rays : t0=0, t1=inf (or t0=-inf,t1=0 for inverted ray). +%% I propose to call these objects 'lineArc' +%% +%% @seealso{lines2d, createEdge, createRay} +%% @end deftypefn + +function line = createLine(varargin) + + if length(varargin)==1 + % Only one input parameter. It can be : + % - line angle + % - array of four parameters + % TODO : add control for arrays of lines. + var = varargin{1}; + + if size(var, 2)==4 + % 4 parameters of the line in a single array. + line = var; + elseif size(var, 2)==1 + % 1 parameter : angle of the line, going through origin. + line = [zeros(size(var)) zeros(size(var)) cos(var) sin(var)]; + else + error('wrong number of dimension for arg1 : can be 1 or 4'); + end + + elseif length(varargin)==2 + % 2 input parameters. They can be : + % - line angle and signed distance to origin. + % - 2 points, then 2 arrays of 1*2 double. + v1 = varargin{1}; + v2 = varargin{2}; + if size(v1, 2)==1 + % first param is angle of line, and second param is signed distance + % to origin. + line = [v1.*cos(v2) v1.*sin(v2) -sin(v2) cos(v2)]; + else + % first input parameter is first point, and second input is the + % second point. + line = [v1(:,1), v1(:,2), v2(:,1)-v1(:,1), v2(:,2)-v1(:,2)]; + end + + elseif length(varargin)==3 + % 3 input parameters : + % first one is a point belonging to the line, + % second and third ones are direction vector of the line (dx and dy). + p = varargin{1}; + line = [p(:,1) p(:,2) varargin{2} varargin{3}]; + + elseif length(varargin)==4 + % 4 input parameters : + % they are x0, y0 (point belongng to line) and dx, dy (direction vector + % of the line). + % All parameters should have the same size. + line = [varargin{1} varargin{2} varargin{3} varargin{4}]; + else + error('Wrong number of arguments in ''createLine'' '); + end + +endfunction + +%!test +%! p1 = [1 1]; +%! p2 = [2 3]; +%! lin = createLine(p1, p2); +%! assert (p1, lin(1,1:2), 1e-6); +%! assert (p2-p1, lin(1,3:4), 1e-6); + +%!test +%! p1 = [1 1;1 1]; +%! p2 = [2 3;2 4]; +%! lin = createLine(p1, p2); +%! assert (2, size(lin, 1)); +%! assert (p1, lin(:,1:2), 1e-6); +%! assert (p2-p1, lin(:,3:4), 1e-6); + Copied: trunk/octave-forge/main/geometry/geom2d/inst/deg2rad.m (from rev 8665, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/deg2rad.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/deg2rad.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/deg2rad.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -0,0 +1,58 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{rad} =} deg2rad(@var{deg}) +%% DEG2RAD Convert angle from degrees to radians +%% +%% Usage: +%% R = deg2rad(D) +%% convert an angle in degrees to an angle in radians. +%% +%% Example +%% deg2rad(180) % gives pi +%% ans = +%% 3.1416 +%% deg2rad(60) % gives pi/3 +%% ans = +%% 1.0472 +%% +%% @seealso{angles2d, rad2deg} +%% @end deftypefn + +function rad = deg2rad(deg) + + rad = deg*pi/180; + +endfunction + Copied: trunk/octave-forge/main/geometry/geom2d/inst/edgeAngle.m (from rev 8665, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeAngle.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/edgeAngle.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/edgeAngle.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -0,0 +1,61 @@ +%% Copyright (c) 2011, INRA +%% 2003-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{theta} =} edgeAngle(@var{edge}) +%% EDGEANGLE Return angle of edge +%% +%% A = edgeAngle(EDGE) +%% Returns the angle between horizontal, right-axis and the edge EDGE. +%% Angle is given in radians, between 0 and 2*pi, in counter-clockwise +%% direction. +%% Notation for edge is [x1 y1 x2 y2] (coordinates of starting and ending +%% points). +%% +%% Example +%% p1 = [10 20]; +%% p2 = [30 40]; +%% rad2deg(edgeAngle([p1 p2])) +%% ans = +%% 45 +%% +%% @seealso{edges2d, angles2d, edgeAngle, lineAngle, edgeLength} +%% @end deftypefn + +function theta = edgeAngle(edge) + + line = createLine(edge(:,1:2), edge(:,3:4)); + theta = lineAngle(line); + +endfunction + Copied: trunk/octave-forge/main/geometry/geom2d/inst/lineAngle.m (from rev 8665, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineAngle.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/lineAngle.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/lineAngle.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -0,0 +1,105 @@ +%% Copyright (c) 2011, INRA +%% 2003-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{theta} =} lineAngle(varargin) +%% LINEANGLE Computes angle between two straight lines +%% +%% A = lineAngle(LINE); +%% Returns the angle between horizontal, right-axis and the given line. +%% Angle is fiven in radians, between 0 and 2*pi, in counter-clockwise +%% direction. +%% +%% A = lineAngle(LINE1, LINE2); +%% Returns the directed angle between the two lines. Angle is given in +%% radians between 0 and 2*pi, in counter-clockwise direction. +%% +%% @seealso{lines2d, angles2d, createLine, normalizeAngle} +%% @end deftypefn + +function theta = lineAngle(varargin) + + nargs = length(varargin); + if nargs == 1 + % angle of one line with horizontal + line = varargin{1}; + theta = mod(atan2(line(:,4), line(:,3)) + 2*pi, 2*pi); + + elseif nargs==2 + % angle between two lines + theta1 = lineAngle(varargin{1}); + theta2 = lineAngle(varargin{2}); + theta = mod(bsxfun(@minus, theta2, theta1)+2*pi, 2*pi); + end + +endfunction + +% horizontal +%!test +%! line1 = createLine([2 3 1 0]); +%! assert (lineAngle(line1), 0, 1e-6); + +%!test +%! line1 = createLine([2 3 0 1]); +%! assert (lineAngle(line1), pi/2, 1e-6); + +%!test +%! line1 = createLine([2 3 1 1]); +%! assert (lineAngle(line1), pi/4, 1e-6); + +%!test +%! line1 = createLine([2 3 5 -1]); +%! assert (lineAngle(line1), mod(atan2(-1, 5)+2*pi, 2*pi), 1e-6); + +%!test +%! line1 = createLine([2 3 5000 -1000]); +%! assert (lineAngle(line1), mod(atan2(-1, 5)+2*pi, 2*pi), 1e-6); + +%!test +%! line1 = createLine([2 3 -1 0]); +%! assert (lineAngle(line1), pi, 1e-6); + +% test lineAngle with two parameters : angle between 2 lines +% check for 2 orthogonal lines +%!test +%! line1 = createLine([1 3 1 0]); +%! line2 = createLine([-2 -1 0 1]); +%! assert (lineAngle(line1, line2), pi/2, 1e-6); +%! assert (lineAngle(line2, line1), 3*pi/2, 1e-6); + +% check for 2 orthogonal lines, with very different parametrizations +%!test +%! line1 = createLine([1 3 1 1]); +%! line2 = createLine([-2 -1 -1000 1000]); +%! assert (lineAngle(line1, line2), pi/2, 1e-6); +%! assert (lineAngle(line2, line1), 3*pi/2, 1e-6); Copied: trunk/octave-forge/main/geometry/geom2d/inst/rad2deg.m (from rev 8665, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rad2deg.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/rad2deg.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/rad2deg.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -0,0 +1,58 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{deg} =} rad2deg(@var{rad}) +% RAD2DEG Convert angle from radians to degrees +% +% Usage: +% R = rad2deg(D) +% convert an angle in radians to angle in degrees +% +% Example: +% rad2deg(pi) +% ans = +% 180 +% rad2deg(pi/3) +% ans = +% 60 +%% +%% @seealso{angles2d, deg2rad} +%% @end deftypefn + +function deg = rad2deg(rad) + + deg = rad*180/pi; + +endfunction + Modified: trunk/octave-forge/main/geometry/geom2d/inst/vectorAngle.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/vectorAngle.m 2011-10-03 23:43:30 UTC (rev 8669) +++ trunk/octave-forge/main/geometry/geom2d/inst/vectorAngle.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -33,7 +33,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{alpha} =} vectorAngle (@var{v1}) -%%VECTORANGLE Angle of a vector, or between 2 vectors +%% VECTORANGLE Angle of a vector, or between 2 vectors %% %% A = vectorAngle(V); %% Returns angle between Ox axis and vector direction, in Counter @@ -194,28 +194,28 @@ %!test %! vecs = [1 0;0 1;0 -1;1 1;1 -1]; %! angs = [0;pi/2;-pi/2;pi/4;-pi/4]; -%! assert(angs, vectorAngle(vecs, 0)); +%! assert(angs, vectorAngle(vecs, 0), 1e-6); %!test %! v1 = [1 0]; %! v2 = [0 1]; %! ang = pi /2 ; -%! assert(ang, vectorAngle(v1, v2)); +%! assert(ang, vectorAngle(v1, v2), 1e-6); %!test %! v1 = [1 0]; %! v2 = [0 1; 0 1; 1 1; -1 1]; %! ang = [pi / 2 ;pi / 2 ;pi / 4 ; 3 * pi / 4]; -%! assert(ang, vectorAngle(v1, v2)); +%! assert(ang, vectorAngle(v1, v2), 1e-6); %!test %! v1 = [0 1; 0 1; 1 1; -1 1]; %! v2 = [-1 0]; %! ang = [pi / 2 ;pi / 2 ; 3 * pi / 4 ; pi / 4]; -%! assert(ang, vectorAngle(v1, v2)); +%! assert(ang, vectorAngle(v1, v2), 1e-6); %!test %! v1 = [1 0; 0 1; 1 1; -1 1]; %! v2 = [0 1; 1 0; -1 1; -1 0]; %! ang = [pi / 2 ;3 * pi / 2 ;pi / 2 ; pi / 4]; -%! assert(ang, vectorAngle(v1, v2)); +%! assert(ang, vectorAngle(v1, v2), 1e-6); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngleSort.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngleSort.m 2011-10-03 23:43:30 UTC (rev 8669) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testAngleSort.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -1,39 +0,0 @@ -function test_suite = testAngleSort(varargin) -%TESTCLIPLINE One-line description here, please. -% output = testAngleSort(input) -% -% Example -% testAngleSort -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. - -initTestSuite; - -function testSimple - -p1 = [0 0]; -p2 = [10 0]; -p3 = [10 10]; -p4 = [0 10]; -pts = [p1;p2;p3;p4]; -center = [5 5]; -expected = pts([3 4 1 2], :); -assertElementsAlmostEqual(expected, angleSort(pts, center)); - -function testSimpleWithAngle - -p1 = [0 0]; -p2 = [10 0]; -p3 = [10 10]; -p4 = [0 10]; -pts = [p1;p2;p3;p4]; -center = [5 5]; -assertElementsAlmostEqual(pts, angleSort(pts, center, -pi)); - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateLine.m 2011-10-03 23:43:30 UTC (rev 8669) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateLine.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -1,38 +0,0 @@ -function test_suite = testCreateLine(varargin) -%testCreateLine One-line description here, please. -% output = testCreateLine(input) -% -% Example -% testCreateLine -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - -function testCreateLine2Points - -p1 = [1 1]; -p2 = [2 3]; -line = createLine(p1, p2); - -assertElementsAlmostEqual(p1, line(1,1:2)); -assertElementsAlmostEqual(p2-p1, line(1,3:4)); - -function testCreateLine2Arrays - -p1 = [1 1;1 1]; -p2 = [2 3;2 4]; -line = createLine(p1, p2); - -assertEqual(2, size(line, 1)); -assertElementsAlmostEqual(p1, line(:,1:2)); -assertElementsAlmostEqual(p2-p1, line(:,3:4)); - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testLineAngle.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testLineAngle.m 2011-10-03 23:43:30 UTC (rev 8669) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testLineAngle.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -1,60 +0,0 @@ -function test_suite = testLineAngle(varargin) %#ok<STOUT> -%TESTLINEANGLE One-line description here, please. -% output = testLineAngle(input) -% -% Example -% testLineAngle -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - -function testLineAngle1 %#ok<*DEFNU> -% test lineAngle with one parameter - -% horizontal -line1 = createLine([2 3 1 0]); -assertElementsAlmostEqual(lineAngle(line1), 0); - -line1 = createLine([2 3 0 1]); -assertElementsAlmostEqual(lineAngle(line1), pi/2); - -line1 = createLine([2 3 1 1]); -assertElementsAlmostEqual(lineAngle(line1), pi/4); - -line1 = createLine([2 3 5 -1]); -assertElementsAlmostEqual(lineAngle(line1), mod(atan2(-1, 5)+2*pi, 2*pi)); - -line1 = createLine([2 3 5000 -1000]); -assertElementsAlmostEqual(lineAngle(line1), mod(atan2(-1, 5)+2*pi, 2*pi)); - -line1 = createLine([2 3 -1 0]); -assertElementsAlmostEqual(lineAngle(line1), pi); - - - -function testLineAngle2 -% test lineAngle with two parameters : angle between 2 lines - -% check for 2 orthogonal lines -line1 = createLine([1 3 1 0]); -line2 = createLine([-2 -1 0 1]); -assertElementsAlmostEqual(lineAngle(line1, line2), pi/2); -assertElementsAlmostEqual(lineAngle(line2, line1), 3*pi/2); - - -% check for 2 orthogonal lines, with very different parametrizations -line1 = createLine([1 3 1 1]); -line2 = createLine([-2 -1 -1000 1000]); -assertElementsAlmostEqual(lineAngle(line1, line2), pi/2); -assertElementsAlmostEqual(lineAngle(line2, line1), 3*pi/2); - - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/test_angleDiff.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/test_angleDiff.m 2011-10-03 23:43:30 UTC (rev 8669) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/test_angleDiff.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -1,34 +0,0 @@ -function test_suite = test_angleDiff(varargin) %#ok<STOUT> -%TEST_ANGLEDIFF Test case for the file angleDiff -% -% Test case for the file angleDiff - -% Example -% test_angleDiff -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2011-07-27, using Matlab 7.9.0.529 (R2009b) -% Copyright 2011 INRA - Cepia Software Platform. - -initTestSuite; - -function test_Simple %#ok<*DEFNU> -% simple tests - - -dif = angleDiff(0, pi/2); -assertAlmostEqual(pi/2, dif); - -dif = angleDiff(pi/2, 0); -assertAlmostEqual(-pi/2, dif); - -dif = angleDiff(0, 3*pi/2); -assertAlmostEqual(-pi/2, dif); - -dif = angleDiff(3*pi/2, 0); -assertAlmostEqual(pi/2, dif); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m 2011-10-03 23:43:30 UTC (rev 8669) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleDiff.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -1,63 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function dif = angleDiff(angle1, angle2) -%ANGLEDIFF Difference between two angles -% -% Computes the signed angular difference between two angles in radians. -% The result is comprised between -PI and +PI. -% -% Example -% A = angleDiff(-pi/4, pi/4) -% A = -% 1.5708 % equal to pi/2 -% A = angleDiff(pi/4, -pi/4) -% A = -% -1.5708 % equal to -pi/2 -% -% See also -% angles2d, angleAbsDiff -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2011-07-27, using Matlab 7.9.0.529 (R2009b) -% Copyright 2011 INRA - Cepia Software Platform. - -% first, normalization -angle1 = normalizeAngle(angle1); -angle2 = normalizeAngle(angle2); - -% compute difference and normalize in [-pi pi] -dif = normalizeAngle(angle2 - angle1, 0); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m 2011-10-03 23:43:30 UTC (rev 8669) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angleSort.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -1,99 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function varargout = angleSort(pts, varargin) -%ANGLESORT Sort points in the plane according to their angle to origin -% -% -% PTS2 = angleSort(PTS); -% Computes angle of points with origin, and sort points with increasing -% angles in Counter-Clockwise direction. -% -% PTS2 = angleSort(PTS, PTS0); -% Computes angles between each point of PTS and PT0, which can be -% different from origin. -% -% PTS2 = angleSort(..., THETA0); -% Specifies the starting angle for sorting. -% -% [PTS2, I] = angleSort(...); -% Also returns in I the indices of PTS, such that PTS2 = PTS(I, :); -% -% See Also: -% points2d, angles2d, angle2points, normalizeAngle -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2005-11-24 -% Copyright 2010 INRA - Cepia Software Platform. - - -% HISTORY : - -% default values -pt0 = [0 0]; -theta0 = 0; - -if length(varargin)==1 - var = varargin{1}; - if size(var, 2)==1 - % specify angle - theta0 = var; - else - pt0 = var; - end -elseif length(varargin)==2 - pt0 = varargin{1}; - theta0 = varargin{2}; -end - - -n = size(pts, 1); -pts2 = pts - repmat(pt0, [n 1]); -angle = lineAngle([zeros(n, 2) pts2]); -angle = mod(angle - theta0 + 2*pi, 2*pi); - -[dummy, I] = sort(angle); - -% format output -if nargout<2 - varargout{1} = pts(I, :); -elseif nargout==2 - varargout{1} = pts(I, :); - varargout{2} = I; -end - - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m 2011-10-03 23:43:30 UTC (rev 8669) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/angles2d.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -1,58 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function angles2d -%ANGLES2D Description of functions for manipulating angles -% -% Angles are normalized in an interval of width 2*PI. Most geom2d -% functions return results in the [0 2*pi] interval, but it can be -% convenient to consider the [-pi pi] interval as well. See the -% normalizeAngle function to switch between conventions. -% -% Angles are usually oriented. The default orientation is the CCW -% (Counter-Clockwise) orientation. -% -% See also: -% normalizeAngle, angleDiff, angleAbsDiff, angleSort -% angle2Points, angle3Points, vectorAngle, lineAngle, edgeAngle -% deg2rad, rad2deg -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2010-03-31, using Matlab 7.4.0.287 (R2007a) -% Copyright 2010 INRA - Cepia Software Platform. - - -help('angles2d'); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLine.m 2011-10-03 23:43:30 UTC (rev 8669) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLine.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -1,156 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function line = createLine(varargin) -%CREATELINE Create a straight line from 2 points, or from other inputs -% -% Line is represented in a parametric form : [x0 y0 dx dy] -% x = x0 + t*dx -% y = y0 + t*dy; -% -% -% L = createLine(p1, p2); -% Returns the line going through the two given points. -% -% L = createLine(x0, y0, dx, dy); -% Returns the line going through point (x0, y0) and with direction -% vector(dx, dy). -% -% L = createLine(LINE); -% where LINE is an array of 4 values, creates the line going through the -% point (LINE(1) LINE(2)), and with direction given by vector (LINE(3) -% LINE(4)). -% -% L = createLine(THETA); -% Create a polar line originated at (0,0) and with angle THETA. -% -% L = createLine(RHO, THETA); -% Create a polar line with normal theta, and with min distance to origin -% equal to rho. rho can be negative, in this case, the line is the same -% as with CREATELINE(-rho, theta+pi), but the orientation is different. -% -% -% Note: in all cases, parameters can be vertical arrays of the same -% dimension. The result is then an array of lines, of dimensions [N*4]. -% -% -% See also: -% lines2d, createEdge, createRay -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 31/10/2003. -% - -% HISTORY : -% 18/02/2004 : add more possibilities to create lines (4 parameters, -% all param in a single tab, and point + dx + dy. -% Also add support for creation of arrays of lines. - -% NOTE : A line can also be represented with a 1*5 array : -% [x0 y0 dx dy t]. -% whith 't' being one of the following : -% - t=0 : line is a singleton (x0,y0) -% - t=1 : line is an edge segment, between points (x0,y0) and (x0+dx, -% y0+dy). -% - t=Inf : line is a Ray, originated from (x0,y0) and going to infinity -% in the direction(dx,dy). -% - t=-Inf : line is a Ray, originated from (x0,y0) and going to infinity -% in the direction(-dx,-dy). -% - t=NaN : line is a real straight line, and contains all points -% verifying the above equation. -% This seems us a convenient way to represent uniformly all kind of lines -% (including edges, rays, and even point). -% - -% NOTE2 : Any line object can be represented using a 1x6 array : -% [x0 y0 dx dy t0 t1] -% the first 4 parameters define the supporting line, -% t0 represent the position of the first point on the line, -% and t1 the position of the last point. -% * for edges : t0 = 0, and t1=1 -% * for straight lines : t0 = -inf, t1=inf -% * for rays : t0=0, t1=inf (or t0=-inf,t1=0 for inverted ray). -% I propose to call these objects 'lineArc' - -if length(varargin)==1 - % Only one input parameter. It can be : - % - line angle - % - array of four parameters - % TODO : add control for arrays of lines. - var = varargin{1}; - - if size(var, 2)==4 - % 4 parameters of the line in a single array. - line = var; - elseif size(var, 2)==1 - % 1 parameter : angle of the line, going through origin. - line = [zeros(size(var)) zeros(size(var)) cos(var) sin(var)]; - else - error('wrong number of dimension for arg1 : can be 1 or 4'); - end - -elseif length(varargin)==2 - % 2 input parameters. They can be : - % - line angle and signed distance to origin. - % - 2 points, then 2 arrays of 1*2 double. - v1 = varargin{1}; - v2 = varargin{2}; - if size(v1, 2)==1 - % first param is angle of line, and second param is signed distance - % to origin. - line = [v1.*cos(v2) v1.*sin(v2) -sin(v2) cos(v2)]; - else - % first input parameter is first point, and second input is the - % second point. - line = [v1(:,1), v1(:,2), v2(:,1)-v1(:,1), v2(:,2)-v1(:,2)]; - end - -elseif length(varargin)==3 - % 3 input parameters : - % first one is a point belonging to the line, - % second and third ones are direction vector of the line (dx and dy). - p = varargin{1}; - line = [p(:,1) p(:,2) varargin{2} varargin{3}]; - -elseif length(varargin)==4 - % 4 input parameters : - % they are x0, y0 (point belongng to line) and dx, dy (direction vector - % of the line). - % All parameters should have the same size. - line = [varargin{1} varargin{2} varargin{3} varargin{4}]; -else - error('Wrong number of arguments in ''createLine'' '); -end Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/deg2rad.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/deg2rad.m 2011-10-03 23:43:30 UTC (rev 8669) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/deg2rad.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -1,59 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function rad = deg2rad(deg) -%DEG2RAD Convert angle from degrees to radians -% -% Usage: -% R = deg2rad(D) -% convert an angle in degrees to an angle in radians. -% -% Example -% deg2rad(180) % gives pi -% ans = -% 3.1416 -% deg2rad(60) % gives pi/3 -% ans = -% 1.0472 -% -% See Also -% angles2d, rad2deg -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 09/12/2004. -% - -rad = deg*pi/180; Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeAngle.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeAngle.m 2011-10-03 23:43:30 UTC (rev 8669) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/edgeAngle.m 2011-10-04 00:06:32 UTC (rev 8670) @@ -1,62 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function theta = edgeAngle(edge) -%EDGEANGLE Return angle of edge -% -% A = edgeAngle(EDGE) -% Returns the angle between horizontal, right-axis and the edge EDGE. -% Angle is given in radians, between 0 and 2*pi, in counter-clockwise -% direction. -% Notation for edge is [x1 y1 x2 y2] (coordinates of starting and ending -% points). -% -% Example -% p1 = [10 20]; -% p2 = [30 40]; -% rad2deg(edgeAngle([p1 p2])) -% ans = -% 45 -% -% See also -% edges2d, angles2d, edgeAngle, lineAngle, edgeLength -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 06/04/2003. -% - -line = createLine(edge(:,1:2), edge(:,3:4)); -theta = lineAngle(line); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineAngle.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/lineAngle.m 2011-10... [truncated message content] |
From: <jpi...@us...> - 2011-10-04 00:13:38
|
Revision: 8672 http://octave.svn.sourceforge.net/octave/?rev=8672&view=rev Author: jpicarbajal Date: 2011-10-04 00:13:32 +0000 (Tue, 04 Oct 2011) Log Message: ----------- geometry. Release geom2d - angles done Modified Paths: -------------- trunk/octave-forge/main/geometry/DESCRIPTION trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/doc/NEWS Modified: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION 2011-10-04 00:09:48 UTC (rev 8671) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2011-10-04 00:13:32 UTC (rev 8672) @@ -1,6 +1,6 @@ Name: Geometry -Version: 1.0.1 -Date: Tuesday, September 27 2011 +Version: 1.1 +Date: 2011-10-04 Author: David Legland <dav...@gr...>, Juan Pablo Carbajal <car...@if...> Maintainer: Juan Pablo Carbajal <car...@if...> Title: Computational Geometry Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2011-10-04 00:09:48 UTC (rev 8671) +++ trunk/octave-forge/main/geometry/INDEX 2011-10-04 00:13:32 UTC (rev 8672) @@ -1,14 +1,25 @@ geometry >> Computational Geometry +Geometry 2D + angle2Points + angle3Points + angleAbsDiff + angleDiff + angles2d + angleSort + createLine + deg2rad + edgeAngle + lineAngle + normalizeAngle + rad2deg + vectorAngle Input svgload svgnormalize svgpath2polygon Output data2geo -Geometry 2D - Geometry 3D - Graphs Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-10-04 00:09:48 UTC (rev 8671) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-10-04 00:13:32 UTC (rev 8672) @@ -13,3 +13,22 @@ Improvements to the docstrings of all functions. =============================================================================== +geometry-1.1 Release Date: 2011-10-04 Release Manager: Juan Pablo Carbajal +=============================================================================== + +* Starting to add geom2d from matGeom +angle2Points.m +angle3Points.m +angleAbsDiff.m +angleDiff.m +angles2d.m +angleSort.m +createLine.m +deg2rad.m +edgeAngle.m +lineAngle.m +normalizeAngle.m +rad2deg.m +vectorAngle.m + +=============================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-05 16:52:59
|
Revision: 8677 http://octave.svn.sourceforge.net/octave/?rev=8677&view=rev Author: jpicarbajal Date: 2011-10-05 16:52:53 +0000 (Wed, 05 Oct 2011) Log Message: ----------- geometry. devel folder for SVG class Added Paths: ----------- trunk/octave-forge/main/geometry/devel/ trunk/octave-forge/main/geometry/devel/@svg/ trunk/octave-forge/main/geometry/devel/@svg/svg.m Added: trunk/octave-forge/main/geometry/devel/@svg/svg.m =================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-05 20:32:28
|
Revision: 8683 http://octave.svn.sourceforge.net/octave/?rev=8683&view=rev Author: jpicarbajal Date: 2011-10-05 20:32:21 +0000 (Wed, 05 Oct 2011) Log Message: ----------- gemoetry. Bezier curves to polygon Modified Paths: -------------- trunk/octave-forge/main/geometry/DESCRIPTION trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/devel/@svg/svg.m trunk/octave-forge/main/geometry/doc/NEWS Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/inst/cbezier2poly.m Modified: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION 2011-10-05 19:42:43 UTC (rev 8682) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2011-10-05 20:32:21 UTC (rev 8683) @@ -1,6 +1,6 @@ Name: Geometry -Version: 1.1 -Date: 2011-10-04 +Version: 1.2 +Date: 2011-10-xx Author: David Legland <dav...@gr...>, Juan Pablo Carbajal <car...@if...> Maintainer: Juan Pablo Carbajal <car...@if...> Title: Computational Geometry Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2011-10-05 19:42:43 UTC (rev 8682) +++ trunk/octave-forge/main/geometry/INDEX 2011-10-05 20:32:21 UTC (rev 8683) @@ -13,6 +13,7 @@ normalizeAngle rad2deg vectorAngle + cbezier2poly Input svgload svgnormalize Modified: trunk/octave-forge/main/geometry/devel/@svg/svg.m =================================================================== --- trunk/octave-forge/main/geometry/devel/@svg/svg.m 2011-10-05 19:42:43 UTC (rev 8682) +++ trunk/octave-forge/main/geometry/devel/@svg/svg.m 2011-10-05 20:32:21 UTC (rev 8683) @@ -14,6 +14,7 @@ ## You should have received a copy of the GNU General Public License ## along with this program; if not, see <http://www.gnu.org/licenses/>. +## -*- texinfo -*- ## @deftypefn {Function File} {@var{obj} =} svg () ## Create object @var{obj} of the svn class. ## Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-10-05 19:42:43 UTC (rev 8682) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-10-05 20:32:21 UTC (rev 8683) @@ -32,3 +32,9 @@ vectorAngle.m =============================================================================== +geometry-1.2 Release Date: 2011-10-xx Release Manager: Juan Pablo Carbajal +=============================================================================== + +* Continue to add geom2d from matGeom + cbezier2poly.m +=============================================================================== Added: trunk/octave-forge/main/geometry/geom2d/inst/cbezier2poly.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/cbezier2poly.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/cbezier2poly.m 2011-10-05 20:32:21 UTC (rev 8683) @@ -0,0 +1,151 @@ +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{pp} =} cbezier2poly (@var{points}) +%% @deftypefnx {Command} {Function File} {[@var{x} @var{y}] =} cbezier2poly (@var{points},@var{t}) +%% Returns the polynomial representation of the cubic Bezier define dby the control points @var{points}. +%% +%% With only one input argument, calculates the polynomial @var{pp} of the cubic +%% Bezier curve defined by the 4 control points stored in @var{points}. +%% @var{points} is either a 4-by-2 array (vertical concatenation of point +%% coordinates), or a 1-by-8 array (horizotnal concatenation of point +%% coordinates). @var{pp} is a 2-by-3 array, 1st row is the polynomial for the +%% x-coordinate and the 2nd row for the y-coordinate. Each row can be evaluated +%% with @code{polyval}. The polynomial @var{pp}(t) is defined for t in [0,1]. +%% +%% When called with a second input argument @var{t}, it returns the coordinates +%% @var{x} and @var{y} corresponding to the polynomial evaluated at @var{t} in +%% [0,1]. +%% +%% @seealso{drawBezierCurve, polyval} +%% @end deftypefn + +function varargout = cbezier2poly (points, ti=[]) + + + % rename points + if size(points, 2)==2 + % case of points given as a 4-by-2 array + p1 = points(1,:); + c1 = points(2,:); + c2 = points(3,:); + p2 = points(4,:); + elseif size(points,2) == 8 + % case of points given as a 1-by-8 array, [X1 Y1 CX1 CX2..] + p1 = points(1:2); + c1 = points(3:4); + c2 = points(5:6); + p2 = points(7:8); + else + print_usage ; + end + + % compute coefficients of Bezier Polynomial + pp = zeros(2,4); + + pp(:,4) = [p1(1); ... + p1(2)]; + pp(:,3) = [3 * c1(1) - 3 * p1(1); ... + 3 * c1(2) - 3 * p1(2)]; + pp(:,2) = [3 * p1(1) - 6 * c1(1) + 3 * c2(1); ... + 3 * p1(2) - 6 * c1(2) + 3 * c2(2)]; + pp(:,1) = [p2(1) - 3 * c2(1) + 3 * c1(1) - p1(1); ... + p2(2) - 3 * c2(2) + 3 * c1(2) - p1(2)]; + + if isempty (ti) + varargout{1} = pp; + else + varargout{1} = polyval (pp(1,:), ti); + varargout{2} = polyval (pp(2,:), ti); + end + +endfunction + +%!demo +%! points = [45.714286 483.79075; ... +%! 241.65656 110.40445; ... +%! 80.185847 741.77381; ... +%! 537.14286 480.93361]; +%! +%! pp = cbezier2poly(points); +%! t = linspace(0,1,64); +%! x = polyval(pp(1,:),t); +%! y = polyval(pp(2,:),t); +%! plot (x,y,'b-',points([1 4],1),points([1 4],2),'s',... +%! points([2 3],1),points([2 3],2),'o'); +%! line(points([2 1],1),points([2 1],2),'color','r'); +%! line(points([3 4],1),points([3 4],2),'color','r'); + +%!demo +%! points = [0 0; ... +%! 1 1; ... +%! 1 1; ... +%! 2 0]; +%! +%! t = linspace(0,1,64); +%! [x y] = cbezier2poly(points,t); +%! plot (x,y,'b-',points([1 4],1),points([1 4],2),'s',... +%! points([2 3],1),points([2 3],2),'o'); +%! line(points([2 1],1),points([2 1],2),'color','r'); +%! line(points([3 4],1),points([3 4],2),'color','r'); + +%!test +%! points = [0 0; ... +%! 1 1; ... +%! 1 1; ... +%! 2 0]; +%! t = linspace(0,1,64); +%! +%! [x y] = cbezier2poly(points,t); +%! pp = cbezier2poly(points); +%! x2 = polyval(pp(1,:),t); +%! y2 = polyval(pp(2,:),t); +%! assert(x,x2); +%! assert(y,y2); + +%!test +%! points = [0 0; ... +%! 1 1; ... +%! 1 1; ... +%! 2 0]; +%! t = linspace(0,1,64); +%! +%! p = reshape(points,1,8); +%! [x y] = cbezier2poly(p,t); +%! pp = cbezier2poly(p); +%! x2 = polyval(pp(1,:),t); +%! y2 = polyval(pp(2,:),t); +%! assert(x,x2); +%! assert(y,y2); + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-06 20:49:06
|
Revision: 8692 http://octave.svn.sourceforge.net/octave/?rev=8692&view=rev Author: jpicarbajal Date: 2011-10-06 20:48:58 +0000 (Thu, 06 Oct 2011) Log Message: ----------- geomatry. Adding boxes and clips Modified Paths: -------------- trunk/octave-forge/main/geometry/geom2d/inst/cbezier2poly.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipRay.m Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/inst/boxes2d.m trunk/octave-forge/main/geometry/geom2d/inst/clipEdge.m trunk/octave-forge/main/geometry/geom2d/inst/clipLine.m trunk/octave-forge/main/geometry/geom2d/inst/clipPoints.m trunk/octave-forge/main/geometry/geom2d/inst/drawBezierCurve.m trunk/octave-forge/main/geometry/geom2d/inst/drawBox.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCliPoints.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipEdge.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipLine.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipPoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipPoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBezierCurve.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBox.m Copied: trunk/octave-forge/main/geometry/geom2d/inst/boxes2d.m (from rev 8687, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/boxes2d.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/boxes2d.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -0,0 +1,53 @@ +%% Copyright (c) 2011, INRA +%% 2008-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} boxes2d () +%% Description of functions operating on bounding boxes. +%% +%% A box is represented as a set of limits in each direction: +%% @example +%% BOX = [XMIN XMAX YMIN YMAX]. +%% @end example +%% @noindent +%% Boxes are used as result of computation for bounding boxes, and to clip +%% shapes. +%% +%% @seealso{clipPoints, clipLine, clipEdge, clipRay, mergeBoxes, +%% intersectBoxes, randomPointInBox, drawBox} +%% @end deftypefn + +function boxes2d(varargin) + help('boxes2d'); +endfunction + Modified: trunk/octave-forge/main/geometry/geom2d/inst/cbezier2poly.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/cbezier2poly.m 2011-10-06 18:57:03 UTC (rev 8691) +++ trunk/octave-forge/main/geometry/geom2d/inst/cbezier2poly.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -34,7 +34,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{pp} =} cbezier2poly (@var{points}) %% @deftypefnx {Command} {Function File} {[@var{x} @var{y}] =} cbezier2poly (@var{points},@var{t}) -%% Returns the polynomial representation of the cubic Bezier define dby the control points @var{points}. +%% Returns the polynomial representation of the cubic Bezier defined by the control points @var{points}. %% %% With only one input argument, calculates the polynomial @var{pp} of the cubic %% Bezier curve defined by the 4 control points stored in @var{points}. Copied: trunk/octave-forge/main/geometry/geom2d/inst/clipEdge.m (from rev 8687, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/clipEdge.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/clipEdge.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -0,0 +1,203 @@ +%% Copyright (c) 2011, INRA +%% 2010-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{edge2} =} clipEdge (@var{edge}, @var{box}) +%% Clip an edge with a rectangular box. +%% +%% @var{edge}: [x1 y1 x2 y2], +%% @var{box} : [xmin xmax ; ymin ymax] or [xmin xmax ymin ymax]; +%% return : +%% @var{edge2} = [xc1 yc1 xc2 yc2]; +%% +%% If clipping is null, return [0 0 0 0]; +%% +%% if @var{edge} is a [nx4] array, return an [nx4] array, corresponding to each +%% clipped edge. +%% +%% @seealso{edges2d, boxes2d, clipLine} +%% @end deftypefn + +function edge2 = clipEdge(edge, bb) + + % process data input + if size(bb, 1)==2 + bb = bb'; + end + + % get limits of window + xmin = bb(1); + xmax = bb(2); + ymin = bb(3); + ymax = bb(4); + + + % convert window limits into lines + lineX0 = [xmin ymin xmax-xmin 0]; + lineX1 = [xmin ymax xmax-xmin 0]; + lineY0 = [xmin ymin 0 ymax-ymin]; + lineY1 = [xmax ymin 0 ymax-ymin]; + + + % compute outcodes of each vertex + p11 = edge(:,1)<xmin; p21 = edge(:,3)<xmin; + p12 = edge(:,1)>xmax; p22 = edge(:,3)>xmax; + p13 = edge(:,2)<ymin; p23 = edge(:,4)<ymin; + p14 = edge(:,2)>ymax; p24 = edge(:,4)>ymax; + out1 = [p11 p12 p13 p14]; + out2 = [p21 p22 p23 p24]; + + % detect edges totally inside window -> no clip. + inside = sum(out1 | out2, 2)==0; + + % detect edges totally outside window + outside = sum(out1 & out2, 2)>0; + + % select edges not totally outside, and process separately edges totally + % inside window + ind = find(~(inside | outside)); + + + edge2 = zeros(size(edge)); + edge2(inside, :) = edge(inside, :); + + + for i=1:length(ind) + % current edge + iedge = edge(ind(i), :); + + % compute intersection points with each line of bounding window + px0 = intersectLineEdge(lineX0, iedge); + px1 = intersectLineEdge(lineX1, iedge); + py0 = intersectLineEdge(lineY0, iedge); + py1 = intersectLineEdge(lineY1, iedge); + + % create array of points + points = [px0; px1; py0; py1; iedge(1:2); iedge(3:4)]; + + % remove infinite points (edges parallel to box edges) + points = points(all(isfinite(points), 2), :); + + % sort points by x then y + points = sortrows(points); + + % get center positions between consecutive points + centers = (points(2:end,:) + points(1:end-1,:))/2; + + % find the centers (if any) inside window + inside = find( centers(:,1)>=xmin & centers(:,2)>=ymin & ... + centers(:,1)<=xmax & centers(:,2)<=ymax); + + % if multiple segments are inside box, which can happen due to finite + % resolution, only take the longest segment + if length(inside)>1 + % compute delta vectors of the segments + dv = points(inside+1,:) - points(inside,:); + % compute lengths of segments + len = hypot(dv(:,1), dv(:,2)); + % find index of longest segment + [a, I] = max(len); %#ok<ASGLU> + inside = inside(I); + end + + % if one of the center points is inside box, then the according edge + % segment is indide box + if length(inside)==1 + % restore same direction of edge + if iedge(1)>iedge(3) || (iedge(1)==iedge(3) && iedge(2)>iedge(4)) + edge2(i, :) = [points(inside+1,:) points(inside,:)]; + else + edge2(i, :) = [points(inside,:) points(inside+1,:)]; + end + end + + end % end of loop of edges +endfunction + +%!demo +%! bb = [0 100 0 100]; +%! edge = [-10 10 90 110]; +%! ec = clipEdge (edge, bb); +%! +%! drawBox(bb,'color','k'); +%! line(edge([1 3]),edge([2 4]),'color','b'); +%! line(ec([1 3]),ec([2 4]),'color','r','linewidth',2); +%! axis tight +%! v = axis (); +%! axis(v+[0 10 -10 0]) + +%!shared bb +%! bb = [0 100 0 100]; +%!assert (clipEdge([20 30 80 60], bb), [20 30 80 60],1e-6); +%!assert (clipEdge([0 30 80 60], bb), [0 30 80 60],1e-6); +%!assert (clipEdge([0 30 100 60], bb), [0 30 100 60],1e-6); +%!assert (clipEdge([30 0 80 100], bb), [30 0 80 100],1e-6); +%!assert (clipEdge([0 0 100 100], bb), [0 0 100 100],1e-6); +%!assert (clipEdge([0 100 100 0], bb), [0 100 100 0],1e-6); +%!assert (clipEdge([20 60 120 60], bb), [20 60 100 60],1e-6); +%!assert (clipEdge([-20 60 80 60], bb), [0 60 80 60],1e-6); +%!assert (clipEdge([20 60 20 160], bb), [20 60 20 100],1e-6); +%!assert (clipEdge([20 -30 20 60], bb), [20 0 20 60],1e-6); +%!assert (clipEdge([120 30 180 60], bb), [0 0 0 0],1e-6); +%!assert (clipEdge([-20 30 -80 60], bb), [0 0 0 0],1e-6); +%!assert (clipEdge([30 120 60 180], bb), [0 0 0 0],1e-6); +%!assert (clipEdge([30 -20 60 -80], bb), [0 0 0 0],1e-6); +%!assert (clipEdge([-120 110 190 150], bb), [0 0 0 0],1e-6); +%!assert ([50 50 100 50], clipEdge([50 50 150 50], bb),1e-6); +%!assert ([50 50 0 50], clipEdge([50 50 -50 50], bb),1e-6); +%!assert ([50 50 50 100], clipEdge([50 50 50 150], bb),1e-6); +%!assert ([50 50 50 0], clipEdge([50 50 50 -50], bb),1e-6); +%!assert ([80 50 100 70], clipEdge([80 50 130 100], bb),1e-6); +%!assert ([80 50 100 30], clipEdge([80 50 130 0], bb),1e-6); +%!assert ([20 50 0 70], clipEdge([20 50 -30 100], bb),1e-6); +%!assert ([20 50 0 30], clipEdge([20 50 -30 0], bb),1e-6); +%!assert ([50 80 70 100], clipEdge([50 80 100 130], bb),1e-6); +%!assert ([50 80 30 100], clipEdge([50 80 0 130], bb),1e-6); +%!assert ([50 20 70 0], clipEdge([50 20 100 -30], bb),1e-6); +%!assert ([50 20 30 0], clipEdge([50 20 0 -30], bb),1e-6); +%!assert ([100 50 50 50], clipEdge([150 50 50 50], bb),1e-6); +%!assert ([0 50 50 50], clipEdge([-50 50 50 50], bb),1e-6); +%!assert ([50 100 50 50], clipEdge([50 150 50 50], bb),1e-6); +%!assert ([50 0 50 50], clipEdge([50 -50 50 50], bb),1e-6); +%!assert ([100 70 80 50], clipEdge([130 100 80 50], bb),1e-6); +%!assert ([100 30 80 50], clipEdge([130 0 80 50], bb),1e-6); +%!assert ([0 70 20 50], clipEdge([-30 100 20 50], bb),1e-6); +%!assert ([0 30 20 50], clipEdge([-30 0 20 50], bb),1e-6); +%!assert ([70 100 50 80], clipEdge([100 130 50 80], bb),1e-6); +%!assert ([30 100 50 80], clipEdge([0 130 50 80], bb),1e-6); +%!assert ([70 0 50 20], clipEdge([100 -30 50 20], bb),1e-6); +%!assert ([30 0 50 20], clipEdge([0 -30 50 20], bb),1e-6); +%!assert ([0 20 80 100], clipEdge([-10 10 90 110], bb),1e-6); + + + Copied: trunk/octave-forge/main/geometry/geom2d/inst/clipLine.m (from rev 8687, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/clipLine.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/clipLine.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -0,0 +1,210 @@ +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{edge} =} clipLine (@var{line}, @var{box}) +%% Clip a line with a box. +%% +%% @var{line} is a straight line given as a 4 element row vector: [x0 y0 dx dy], +%% with (x0 y0) being a point of the line and (dx dy) a direction vector, +%% @var{box} is the clipping box, given by its extreme coordinates: +%% [xmin xmax ymin ymax]. +%% The result is given as an edge, defined by the coordinates of its 2 +%% extreme points: [x1 y1 x2 y2]. +%% If line does not intersect the box, [NaN NaN NaN NaN] is returned. +%% +%% Function works also if @var{line} is a Nx4 array, if @var{box} is a Nx4 array, or +%% if both @var{line} and @var{box} are Nx4 arrays. In these cases, @var{edge} is a Nx4 +%% array. +%% +%% Example: +%% +%% @example +%% line = [30 40 10 0]; +%% box = [0 100 0 100]; +%% res = clipLine(line, box) +%% res = +%% 0 40 100 40 +%% @end example +%% +%% @seealso{lines2d, boxes2d, edges2d, clipEdge, clipRay} +%% @end deftypefn + +function edge = clipLine(lin, bb, varargin) + + % adjust size of two input arguments + if size(lin, 1)==1 + lin = repmat(lin, size(bb, 1), 1); + elseif size(bb, 1)==1 + bb = repmat(bb, size(lin, 1), 1); + elseif size(lin, 1) ~= size(bb, 1) + error('bad sizes for input'); + end + + % allocate memory + nbLines = size(lin, 1); + edge = zeros(nbLines, 4); + + % main loop on lines + for i=1:nbLines + % extract limits of the box + xmin = bb(i, 1); + xmax = bb(i, 2); + ymin = bb(i, 3); + ymax = bb(i, 4); + + % use direction vector for box edges similar to direction vector of the + % line in order to reduce computation errors + delta = hypot(lin(i,3), lin(i,4)); + + + % compute intersection with each edge of the box + + % lower edge + px1 = intersectLines(lin(i,:), [xmin ymin delta 0]); + % right edge + px2 = intersectLines(lin(i,:), [xmax ymin 0 delta]); + % upper edge + py1 = intersectLines(lin(i,:), [xmax ymax -delta 0]); + % left edge + py2 = intersectLines(lin(i,:), [xmin ymax 0 -delta]); + + % remove undefined intersections (case of lines parallel to box edges) + points = [px1 ; px2 ; py1 ; py2]; + points = points(isfinite(points(:,1)), :); + + % sort points according to their position on the line + pos = linePosition(points, lin(i,:)); + [pos inds] = sort(pos); %#ok<ASGLU> + points = points(inds, :); + + % create clipped edge by using the two points in the middle + ind = size(points, 1)/2; + inter1 = points(ind,:); + inter2 = points(ind+1,:); + edge(i, 1:4) = [inter1 inter2]; + + % check that middle point of the edge is contained in the box + midX = mean(edge(i, [1 3])); + xOk = xmin <= midX && midX <= xmax; + midY = mean(edge(i, [2 4])); + yOk = ymin <= midY && midY <= ymax; + + % if one of the bounding condition is not met, set edge to NaN + if ~(xOk && yOk) + edge (i,:) = NaN; + end + end +endfunction + +%!demo +%! lin = [30 40 10 0]; +%! bb = [0 100 0 100]; +%! res = clipLine(line, bb) +%! +%! drawBox(bb,'color','k'); +%! line(lin([1 3]),lin([2 4]),'color','b'); +%! line(res([1 3]),res([2 4]),'color','r','linewidth',2); +%! axis tight +%! v = axis (); +%! axis(v+[0 10 -10 0]) + +%!test % inside, to the right % inside, to the left% outside +%! bb = [0 100 0 100]; +%! lin = [30 40 10 0]; +%! edge = [0 40 100 40]; +%! assert (edge, clipLine(lin, bb), 1e-6); +%! lin = [30 40 -10 0]; +%! edge = [100 40 0 40]; +%! assert (edge, clipLine(lin, bb), 1e-6); +%! lin = [30 140 10 0]; +%! assert (sum(isnan(clipLine(lin, bb)))==4); + +%!test % inside, upward % inside, downward % outside +%! bb = [0 100 0 100]; +%! lin = [30 40 0 10]; +%! edge = [30 0 30 100]; +%! assert (edge, clipLine(lin, bb), 1e-6); +%! lin = [30 40 0 -10]; +%! edge = [30 100 30 0]; +%! assert (edge, clipLine(lin, bb), 1e-6); +%! lin = [140 30 0 10]; +%! assert (sum(isnan(clipLine(lin, bb)))==4); + +%!test % inside, top right corner% inside, down right corner % outside +%! bb = [0 100 0 100]; +%! lin = [80 30 10 10]; +%! edge = [50 0 100 50]; +%! assert (edge, clipLine(lin, bb), 1e-6); +%! lin = [20 70 10 10]; +%! edge = [0 50 50 100]; +%! assert (edge, clipLine(lin, bb), 1e-6); +%! lin = [140 -30 10 10]; +%! assert (sum(isnan(clipLine(lin, bb)))==4); +%! lin = [-40 130 10 10]; +%! assert (sum(isnan(clipLine(lin, bb)))==4); + +%!test %multilines % inside, top right corner +%! bb = [0 100 0 100]; +%! lin = [... +%! 80 30 10 10; ... +%! 20 70 10 10; ... +%! 140 -30 10 10; ... +%! -40 130 10 10]; +%! edge = [... +%! 50 0 100 50; ... +%! 0 50 50 100; ... +%! NaN NaN NaN NaN; ... +%! NaN NaN NaN NaN; ... +%! ]; +%! clipped = clipLine(lin, bb); +%! assert (4, size(clipped, 1)); +%! assert (edge(1:2, :), clipped(1:2, :), 1e-6); +%! assert (sum(isnan(clipped(3,:)))==4); +%! assert (sum(isnan(clipped(4,:)))==4); + +%!test % test clipping of horizontal lines % inside, to the right +%! bb = [-1 1 -1 1]*1e10; +%! lin = [3 0 1 2]; +%! D = 1e10; +%! edge = [3-D/2 -D 3+D/2 D]; +%! clipped = clipLine(lin, bb); +%! assert (edge, clipped); + +%!test % inside, to the right +%! bb = [-1 1 -1 1]*100; +%! lin = [3 0 1*1e10 2*1e10]; +%! D = 100; +%! edge = [3-D/2 -D 3+D/2 D]; +%! clipped = clipLine(lin, bb); +%! assert (edge, clipped, 1e-6); Copied: trunk/octave-forge/main/geometry/geom2d/inst/clipPoints.m (from rev 8687, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipPoints.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/clipPoints.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/clipPoints.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -0,0 +1,101 @@ +%% Copyright (c) 2011, INRA +%% 2008-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{points2} =} clipPoints (@var{points}, @var{box}) +%% Clip a set of points by a box. +%% +%% Returns the set @var{points2} which are located inside of the box @var{box}. +%% +%% @seealso{points2d, boxes2d, clipLine, drawPoint} +%% @end deftypefn + +function points = clipPoints(points, bb) + + % get bounding box limits + xmin = bb(1); + xmax = bb(2); + ymin = bb(3); + ymax = bb(4); + + % compute indices of points inside visible area + xOk = points(:,1)>=xmin & points(:,1)<=xmax; + yOk = points(:,2)>=ymin & points(:,2)<=ymax; + + % keep only points inside box + points = points(xOk & yOk, :); + +endfunction + +%!demo +%! points = 2*rand(100,2)-1; +%! bb = [-0.5 0.5 -0.25 0.25]; +%! cpo = clipPoints (points, bb); +%! +%! plot(points(:,1),points(:,2),'xr') +%! hold on +%! drawBox(bb,'color','k') +%! plot(cpo(:,1),cpo(:,2),'*g') +%! hold off + +%!shared bb +%! bb = [0 10 0 20]; + +%!test +%! corners = [0 0;10 0;0 20;10 20]; +%! cornersClipped = clipPoints(corners, bb); +%! assert (4, size(cornersClipped, 1)); +%! assert (corners, cornersClipped, 1e-6); + +%!test +%! borders = [0 5;10 5;5 0;5 20]; +%! bordersClipped = clipPoints(borders, bb); +%! assert (4, size(bordersClipped, 1)); +%! assert (borders, bordersClipped, 1e-6); + +%!test +%! inside = [5 5;5 10;5 15]; +%! insideClipped = clipPoints(inside, bb); +%! assert (size(inside, 1), size(insideClipped, 1)); +%! assert (inside, insideClipped); + +%!test +%! points = [-1 0;11 0;-1 20;11 20;0 -1;0 21;10 -1;10 21]; +%! pointsClipped = clipPoints(points, bb); +%! assert (0, size(pointsClipped, 1)); + +%!test +%! points = [-5 10;0 10;5 10;10 10; 15 10]; +%! pointsClipped = clipPoints(points, bb); +%! assert (3, size(pointsClipped, 1)); +%! assert (points(2:4,:), pointsClipped, 1e-6); Copied: trunk/octave-forge/main/geometry/geom2d/inst/drawBezierCurve.m (from rev 8687, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBezierCurve.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/drawBezierCurve.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/drawBezierCurve.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -0,0 +1,107 @@ +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} drawBezierCurve (@var{points}) +%% @deftypefnx {Command} {Function File} drawBezierCurve (@var{pp}) +%% @deftypefnx {Command} {Function File} drawBezierCurve (@ldots, @var{param}, @var{value}, ...) +%% @deftypefnx {Command} {Function File} {@var{h} =}drawBezierCurve (...) +%% Draw a cubic bezier curve defined by the control points @var{points}. +%% +%% With only one input argument, draws the Bezier curve defined by the 4 control +%% points stored in @var{points}. @var{points} is either a 4-by-2 array +%% (vertical concatenation of point coordinates), or a 1-by-8 array (horizotnal +%% concatenation of point coordinates). The curve could be described by its +%% polynomial (output of @code{cbezier2poly}) @var{pp}, which should be a 2-by-4 +%% array. +%% +%% The optional @var{param}, @var{value} pairs specify additional drawing +%% parameters, see the @code{plot} function for details. The specific parameter +%% 'discretization' with an integer associated value defines the amount of +%% points used to plot the curve. If the output is requiered, the function +%% returns the handle to the created graphic object. +%% +%% @seealso{cbezier2poly, plot} +%% @end deftypefn + +function varargout = drawBezierCurve(points, varargin) + + % default number of discretization steps + N = 64; + + % check if discretization step is specified + if ~isempty(varargin) + [tf idx] = ismember ({'discretization'},{varargin{1:2:end}}); + if ~isempty(idx) + N = varargin{idx+1}; + varargin(idx:idx+1) = []; + end + end + + % parametrization variable for bezier (use N+1 points to have N edges) + t = linspace(0, 1, N+1); + + if any(size(points) ~= [2 4]) + [x y] = cbezier2poly(points,t); + else + % Got a polynomial description + x = polyval(points(1,:),t); + y = polyval(points(2,:),t); + end + + % draw the curve + h = plot(x, y, varargin{:}); + + % eventually return a handle to the created object + if nargout > 0 + varargout = {h}; + end +endfunction + +%!demo +%! points = [0 0; 3 1; -2 1; 1 0]; +%! drawBezierCurve(points); +%! hold on +%! plot(points([1 4],1),points([1 4],2),'go'); +%! plot(points([2 3],1),points([2 3],2),'rs'); +%! line(points([1 2],1),points([1 2],2),'color','k'); +%! line(points([3 4],1),points([3 4],2),'color','k'); +%! h = drawBezierCurve(points, 'discretization', 6, 'color','r'); +%! hold off + +%!shared p +%! p = [0 0; 3 1; -2 1; 1 0]; +%!error(drawBezier()) +%!error(drawBezier ('discretization')) +%!error(drawBezier (p, 'discretization', 'a')) +%!error(drawBezier (p(:))) Copied: trunk/octave-forge/main/geometry/geom2d/inst/drawBox.m (from rev 8687, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawBox.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/drawBox.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/drawBox.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -0,0 +1,81 @@ +%% Copyright (c) 2011, INRA +%% 2003-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{h} =} drawBox (@var{box}) +%% @deftypefnx {Function File} {@var{h} =} drawBox (@var{box}, @var{param}, @var{value}, ...) +%% Draw a box defined by coordinate extents +%% +%% Draws a box defined by its extent: @var{box} = [@var{xmin} @var{xmax} +%% @var{ymin} @var{ymax}]. Addtional +%% arguments are passed to function @code{plot}. If requested, it returns the +%% handle to the graphics object created. +%% +%% @seealso{drawOrientedBox, drawRect, plot} +%% @end deftypefn + +function varargout = drawBox(box, varargin) + + % default values + xmin = box(:,1); + xmax = box(:,2); + ymin = box(:,3); + ymax = box(:,4); + + nBoxes = size(box, 1); + r = zeros(nBoxes, 1); + + % iterate on boxes + for i = 1:nBoxes + % exract min and max values + tx(1) = xmin(i); + ty(1) = ymin(i); + tx(2) = xmax(i); + ty(2) = ymin(i); + tx(3) = xmax(i); + ty(3) = ymax(i); + tx(4) = xmin(i); + ty(4) = ymax(i); + tx(5) = xmin(i); + ty(5) = ymin(i); + + % display polygon + r(i) = plot(tx, ty, varargin{:}); + end + + % format output + if nargout > 0 + varargout = {r}; + end + +endfunction Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCliPoints.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCliPoints.m 2011-10-06 18:57:03 UTC (rev 8691) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCliPoints.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -1,58 +0,0 @@ -function test_suite = testClipPoints(varargin) -%TESTCLIPLINE One-line description here, please. -% output = testClipPoints(input) -% -% Example -% testClipPoints -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. - -initTestSuite; - -function testAllInside -% all points inside window, possibly touching edges - -box = [0 10 0 20]; -corners = [0 0;10 0;0 20;10 20]; - -cornersClipped = clipPoints(corners, box); -assertEqual(4, size(cornersClipped, 1)); -assertElementsAlmostEqual(corners, cornersClipped); - -borders = [0 5;10 5;5 0;5 20]; -bordersClipped = clipPoints(borders, box); -assertEqual(4, size(bordersClipped, 1)); -assertElementsAlmostEqual(borders, bordersClipped); - -inside = [5 5;5 10;5 15]; -insideClipped = clipPoints(inside, box); -assertEqual(size(inside, 1), size(insideClipped, 1)); -assertElementsAlmostEqual(inside, insideClipped); - - -function testAllOutside -% all points outside window - -box = [0 10 0 20]; -points = [-1 0;11 0;-1 20;11 20;0 -1;0 21;10 -1;10 21]; - -pointsClipped = clipPoints(points, box); -assertEqual(0, size(pointsClipped, 1)); - - -function testMixed -% all points inside window, possibly touching edges - -box = [0 10 0 20]; -points = [-5 10;0 10;5 10;10 10; 15 10]; - -pointsClipped = clipPoints(points, box); -assertEqual(3, size(pointsClipped, 1)); -assertElementsAlmostEqual(points(2:4,:), pointsClipped); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipEdge.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipEdge.m 2011-10-06 18:57:03 UTC (rev 8691) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipEdge.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -1,100 +0,0 @@ -function test_suite = testClipEdge(varargin) %#ok<STOUT> -%TESTCLIPEDGE One-line description here, please. -% output = testClipEdge(input) -% -% Example -% testClipEdge -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - -function testInside %#ok<*DEFNU> -% test edges totally inside window, possibly touching edges - -box = [0 100 0 100]; -assertElementsAlmostEqual(clipEdge([20 30 80 60], box), [20 30 80 60]); -assertElementsAlmostEqual(clipEdge([0 30 80 60], box), [0 30 80 60]); -assertElementsAlmostEqual(clipEdge([0 30 100 60], box), [0 30 100 60]); -assertElementsAlmostEqual(clipEdge([30 0 80 100], box), [30 0 80 100]); -assertElementsAlmostEqual(clipEdge([0 0 100 100], box), [0 0 100 100]); -assertElementsAlmostEqual(clipEdge([0 100 100 0], box), [0 100 100 0]); - -function testClip -% test edges totally inside window, possibly touching edges - -box = [0 100 0 100]; -assertElementsAlmostEqual(clipEdge([20 60 120 60], box), [20 60 100 60]); -assertElementsAlmostEqual(clipEdge([-20 60 80 60], box), [0 60 80 60]); -assertElementsAlmostEqual(clipEdge([20 60 20 160], box), [20 60 20 100]); -assertElementsAlmostEqual(clipEdge([20 -30 20 60], box), [20 0 20 60]); - - -function testOutside -% test edges totally outside window - -box = [0 100 0 100]; -assertElementsAlmostEqual(clipEdge([120 30 180 60], box), [0 0 0 0]); -assertElementsAlmostEqual(clipEdge([-20 30 -80 60], box), [0 0 0 0]); -assertElementsAlmostEqual(clipEdge([30 120 60 180], box), [0 0 0 0]); -assertElementsAlmostEqual(clipEdge([30 -20 60 -80], box), [0 0 0 0]); -assertElementsAlmostEqual(clipEdge([-120 110 190 150], box), [0 0 0 0]); - -function testClipLast -% test edges clipped at last extremity, with orthogonal edges - -box = [0 100 0 100]; -assertAlmostEqual([50 50 100 50], clipEdge([50 50 150 50], box)); -assertAlmostEqual([50 50 0 50], clipEdge([50 50 -50 50], box)); -assertAlmostEqual([50 50 50 100], clipEdge([50 50 50 150], box)); -assertAlmostEqual([50 50 50 0], clipEdge([50 50 50 -50], box)); - -function testClipLastDiag -% test edges clipped at last extremity, with diagonal edges - -box = [0 100 0 100]; -assertAlmostEqual([80 50 100 70], clipEdge([80 50 130 100], box)); -assertAlmostEqual([80 50 100 30], clipEdge([80 50 130 0], box)); -assertAlmostEqual([20 50 0 70], clipEdge([20 50 -30 100], box)); -assertAlmostEqual([20 50 0 30], clipEdge([20 50 -30 0], box)); -assertAlmostEqual([50 80 70 100], clipEdge([50 80 100 130], box)); -assertAlmostEqual([50 80 30 100], clipEdge([50 80 0 130], box)); -assertAlmostEqual([50 20 70 0], clipEdge([50 20 100 -30], box)); -assertAlmostEqual([50 20 30 0], clipEdge([50 20 0 -30], box)); - -function testClipFirst -% test edges clipped at first extremity, with orthogonal edges - -box = [0 100 0 100]; -assertAlmostEqual([100 50 50 50], clipEdge([150 50 50 50], box)); -assertAlmostEqual([0 50 50 50], clipEdge([-50 50 50 50], box)); -assertAlmostEqual([50 100 50 50], clipEdge([50 150 50 50], box)); -assertAlmostEqual([50 0 50 50], clipEdge([50 -50 50 50], box)); - -function testClipFirstDiag -% test edges clipped at last extremity, with diagonal edges - -box = [0 100 0 100]; -assertAlmostEqual([100 70 80 50], clipEdge([130 100 80 50], box)); -assertAlmostEqual([100 30 80 50], clipEdge([130 0 80 50], box)); -assertAlmostEqual([0 70 20 50], clipEdge([-30 100 20 50], box)); -assertAlmostEqual([0 30 20 50], clipEdge([-30 0 20 50], box)); -assertAlmostEqual([70 100 50 80], clipEdge([100 130 50 80], box)); -assertAlmostEqual([30 100 50 80], clipEdge([0 130 50 80], box)); -assertAlmostEqual([70 0 50 20], clipEdge([100 -30 50 20], box)); -assertAlmostEqual([30 0 50 20], clipEdge([0 -30 50 20], box)); - -function testClipBoth -% test edges clipped at both extremities - -box = [0 100 0 100]; -assertAlmostEqual([0 20 80 100], clipEdge([-10 10 90 110], box)); - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipLine.m 2011-10-06 18:57:03 UTC (rev 8691) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipLine.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -1,126 +0,0 @@ -function test_suite = testClipLine(varargin) %#ok<STOUT> -% Tests the function 'clipLine' -% output = testClipLine(input) -% -% Example -% testClipLine -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - -function testHoriz %#ok<*DEFNU> -% test clipping of horizontal lines - -box = [0 100 0 100]; - -% inside, to the right -line = [30 40 10 0]; -edge = [0 40 100 40]; -assertElementsAlmostEqual(edge, clipLine(line, box)); - -% inside, to the left -line = [30 40 -10 0]; -edge = [100 40 0 40]; -assertElementsAlmostEqual(edge, clipLine(line, box)); - -% outside -line = [30 140 10 0]; -assertTrue(sum(isnan(clipLine(line, box)))==4); - -function testVert -% test clipping of vertical lines - -box = [0 100 0 100]; - -% inside, upward -line = [30 40 0 10]; -edge = [30 0 30 100]; -assertElementsAlmostEqual(edge, clipLine(line, box)); - -% inside, downward -line = [30 40 0 -10]; -edge = [30 100 30 0]; -assertElementsAlmostEqual(edge, clipLine(line, box)); - -% outside -line = [140 30 0 10]; -assertTrue(sum(isnan(clipLine(line, box)))==4); - -function testDiagUp -% test clipping of upward diagonal lines - -box = [0 100 0 100]; - -% inside, top right corner -line = [80 30 10 10]; -edge = [50 0 100 50]; -assertElementsAlmostEqual(edge, clipLine(line, box)); - -% inside, down right corner -line = [20 70 10 10]; -edge = [0 50 50 100]; -assertElementsAlmostEqual(edge, clipLine(line, box)); - -% outside -line = [140 -30 10 10]; -assertTrue(sum(isnan(clipLine(line, box)))==4); - -line = [-40 130 10 10]; -assertTrue(sum(isnan(clipLine(line, box)))==4); - - -function testMultiLines - -box = [0 100 0 100]; - -% inside, top right corner -line = [... - 80 30 10 10; ... - 20 70 10 10; ... - 140 -30 10 10; ... - -40 130 10 10]; -edge = [... - 50 0 100 50; ... - 0 50 50 100; ... - NaN NaN NaN NaN; ... - NaN NaN NaN NaN; ... - ]; - -clipped = clipLine(line, box); -assertEqual(4, size(clipped, 1)); -assertElementsAlmostEqual(edge(1:2, :), clipped(1:2, :)); -assertTrue(sum(isnan(clipped(3,:)))==4); -assertTrue(sum(isnan(clipped(4,:)))==4); - -function testBigBox -% test clipping of horizontal lines - -box = [-1 1 -1 1]*1e10; - -% inside, to the right -line = [3 0 1 2]; -D = 1e10; -edge = [3-D/2 -D 3+D/2 D]; -clipped = clipLine(line, box); -assertElementsAlmostEqual(edge, clipped); - -function testBigLine -% test clipping of horizontal lines - -box = [-1 1 -1 1]*100; - -% inside, to the right -line = [3 0 1*1e10 2*1e10]; -D = 100; -edge = [3-D/2 -D 3+D/2 D]; -clipped = clipLine(line, box); -assertElementsAlmostEqual(edge, clipped); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipPoints.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipPoints.m 2011-10-06 18:57:03 UTC (rev 8691) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipPoints.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -1,58 +0,0 @@ -function test_suite = testClipPoints(varargin) -%TESTCLIPLINE One-line description here, please. -% output = testClipPoints(input) -% -% Example -% testClipPoints -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. - -initTestSuite; - -function testAllInside -% all points inside window, possibly touching edges - -box = [0 10 0 20]; -corners = [0 0;10 0;0 20;10 20]; - -cornersClipped = clipPoints(corners, box); -assertEqual(4, size(cornersClipped, 1)); -assertElementsAlmostEqual(corners, cornersClipped); - -borders = [0 5;10 5;5 0;5 20]; -bordersClipped = clipPoints(borders, box); -assertEqual(4, size(bordersClipped, 1)); -assertElementsAlmostEqual(borders, bordersClipped); - -inside = [5 5;5 10;5 15]; -insideClipped = clipPoints(inside, box); -assertEqual(size(inside, 1), size(insideClipped, 1)); -assertElementsAlmostEqual(inside, insideClipped); - - -function testAllOutside -% all points outside window - -box = [0 10 0 20]; -points = [-1 0;11 0;-1 20;11 20;0 -1;0 21;10 -1;10 21]; - -pointsClipped = clipPoints(points, box); -assertEqual(0, size(pointsClipped, 1)); - - -function testMixed -% all points inside window, possibly touching edges - -box = [0 10 0 20]; -points = [-5 10;0 10;5 10;10 10; 15 10]; - -pointsClipped = clipPoints(points, box); -assertEqual(3, size(pointsClipped, 1)); -assertElementsAlmostEqual(points(2:4,:), pointsClipped); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m 2011-10-06 18:57:03 UTC (rev 8691) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/boxes2d.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -1,55 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function boxes2d(varargin) -%BOXES2D Description of functions operating on bounding boxes -% -% A box is represented as a set of limits in each direction: -% BOX = [XMIN XMAX YMIN YMAX]. -% -% Boxes are used as result of computation for bounding boxes, and to clip -% shapes. -% -% See also -% clipPoints, clipLine, clipEdge, clipRay -% mergeBoxes, intersectBoxes, randomPointInBox -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2008-10-13, using Matlab 7.4.0.287 (R2007a) -% Copyright 2010 INRA - Cepia Software Platform. - -help('boxes2d'); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m 2011-10-06 18:57:03 UTC (rev 8691) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipEdge.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -1,157 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function edge2 = clipEdge(edge, box) -%CLIPEDGE Clip an edge with a rectangular box -% -% EDGE2 = clipEdge(EDGE, BOX); -% EDGE: [x1 y1 x2 y2], -% BOX : [xmin xmax ; ymin ymax] or [xmin xmax ymin ymax]; -% return : -% EDGE2 = [xc1 yc1 xc2 yc2]; -% -% If clipping is null, return [0 0 0 0]; -% -% if EDGE is a [nx4] array, return an [nx4] array, corresponding to each -% clipped edge. -% -% See also -% edges2d, boxes2d, clipLine -% -% --------- -% author : David Legland -% created the 14/05/2005. -% Copyright 2010 INRA - Cepia Software Platform. - -% HISTORY -% 2007-01-08 sort points according to position on edge, not to x coord -% -> this allows to return edges with same orientation a source, and -% to keep first or end points at the same position if their are not -% clipped. -% 01/10/2010 fix bug due to precision, thanks to Reto Zingg. - -% process data input -if size(box, 1)==2 - box = box'; -end - -% get limits of window -xmin = box(1); -xmax = box(2); -ymin = box(3); -ymax = box(4); - - -% convert window limits into lines -lineX0 = [xmin ymin xmax-xmin 0]; -lineX1 = [xmin ymax xmax-xmin 0]; -lineY0 = [xmin ymin 0 ymax-ymin]; -lineY1 = [xmax ymin 0 ymax-ymin]; - - -% compute outcodes of each vertex -p11 = edge(:,1)<xmin; p21 = edge(:,3)<xmin; -p12 = edge(:,1)>xmax; p22 = edge(:,3)>xmax; -p13 = edge(:,2)<ymin; p23 = edge(:,4)<ymin; -p14 = edge(:,2)>ymax; p24 = edge(:,4)>ymax; -out1 = [p11 p12 p13 p14]; -out2 = [p21 p22 p23 p24]; - -% detect edges totally inside window -> no clip. -inside = sum(out1 | out2, 2)==0; - -% detect edges totally outside window -outside = sum(out1 & out2, 2)>0; - -% select edges not totally outside, and process separately edges totally -% inside window -ind = find(~(inside | outside)); - - -edge2 = zeros(size(edge)); -edge2(inside, :) = edge(inside, :); - - -for i=1:length(ind) - % current edge - iedge = edge(ind(i), :); - - % compute intersection points with each line of bounding window - px0 = intersectLineEdge(lineX0, iedge); - px1 = intersectLineEdge(lineX1, iedge); - py0 = intersectLineEdge(lineY0, iedge); - py1 = intersectLineEdge(lineY1, iedge); - - % create array of points - points = [px0; px1; py0; py1; iedge(1:2); iedge(3:4)]; - - % remove infinite points (edges parallel to box edges) - points = points(all(isfinite(points), 2), :); - - % sort points by x then y - points = sortrows(points); - - % get center positions between consecutive points - centers = (points(2:end,:) + points(1:end-1,:))/2; - - % find the centers (if any) inside window - inside = find( centers(:,1)>=xmin & centers(:,2)>=ymin & ... - centers(:,1)<=xmax & centers(:,2)<=ymax); - - % if multiple segments are inside box, which can happen due to finite - % resolution, only take the longest segment - if length(inside)>1 - % compute delta vectors of the segments - dv = points(inside+1,:) - points(inside,:); - % compute lengths of segments - len = hypot(dv(:,1), dv(:,2)); - % find index of longest segment - [a, I] = max(len); %#ok<ASGLU> - inside = inside(I); - end - - % if one of the center points is inside box, then the according edge - % segment is indide box - if length(inside)==1 - % restore same direction of edge - if iedge(1)>iedge(3) || (iedge(1)==iedge(3) && iedge(2)>iedge(4)) - edge2(i, :) = [points(inside+1,:) points(inside,:)]; - else - edge2(i, :) = [points(inside,:) points(inside+1,:)]; - end - end - -end % end of loop of edges - - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m 2011-10-06 18:57:03 UTC (rev 8691) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipLine.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -1,138 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function edge = clipLine(line, box, varargin) -%CLIPLINE Clip a line with a box -% -% EDGE = clipLine(LINE, BOX); -% LINE is a straight line given as a 4 element row vector: [x0 y0 dx dy], -% with (x0 y0) being a point of the line and (dx dy) a direction vector, -% BOX is the clipping box, given by its extreme coordinates: -% [xmin xmax ymin ymax]. -% The result is given as an edge, defined by the coordinates of its 2 -% extreme points: [x1 y1 x2 y2]. -% If line does not intersect the box, [NaN NaN NaN NaN] is returned. -% -% Function works also if LINE is a Nx4 array, if BOX is a Nx4 array, or -% if both LINE and BOX are Nx4 arrays. In these cases, EDGE is a Nx4 -% array. -% -% -% Example -% line = [30 40 10 0]; -% box = [0 100 0 100]; -% res = clipLine(line, box) -% res = -% 0 40 100 40 -% -% See also: -% lines2d, boxes2d, edges2d -% clipEdge, clipRay -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2007-08-27, using Matlab 7.4.0.287 (R2007a) -% Copyright 2010 INRA - Cepia Software Platform. - -% HISTORY -% 2010-05-16 rewrite using intersectLines, add precision management -% 2010-08-03 fix bugs (thanks to Reto Zingg) -% 2010-08-06 remove management of EPS by checking edge midpoint (thanks -% again to Reto Zingg) - -% adjust size of two input arguments -if size(line, 1)==1 - line = repmat(line, size(box, 1), 1); -elseif size(box, 1)==1 - box = repmat(box, size(line, 1), 1); -elseif size(line, 1) ~= size(box, 1) - error('bad sizes for input'); -end - -% allocate memory -nbLines = size(line, 1); -edge = zeros(nbLines, 4); - -% main loop on lines -for i=1:nbLines - % extract limits of the box - xmin = box(i, 1); - xmax = box(i, 2); - ymin = box(i, 3); - ymax = box(i, 4); - - % use direction vector for box edges similar to direction vector of the - % line in order to reduce computation errors - delta = hypot(line(i,3), line(i,4)); - - - % compute intersection with each edge of the box - - % lower edge - px1 = intersectLines(line(i,:), [xmin ymin delta 0]); - % right edge - px2 = intersectLines(line(i,:), [xmax ymin 0 delta]); - % upper edge - py1 = intersectLines(line(i,:), [xmax ymax -delta 0]); - % left edge - py2 = intersectLines(line(i,:), [xmin ymax 0 -delta]); - - % remove undefined intersections (case of lines parallel to box edges) - points = [px1 ; px2 ; py1 ; py2]; - points = points(isfinite(points(:,1)), :); - - % sort points according to their position on the line - pos = linePosition(points, line(i,:)); - [pos inds] = sort(pos); %#ok<ASGLU> - points = points(inds, :); - - % create clipped edge by using the two points in the middle - ind = size(points, 1)/2; - inter1 = points(ind,:); - inter2 = points(ind+1,:); - edge(i, 1:4) = [inter1 inter2]; - - % check that middle point of the edge is contained in the box - midX = mean(edge(i, [1 3])); - xOk = xmin <= midX && midX <= xmax; - midY = mean(edge(i, [2 4])); - yOk = ymin <= midY && midY <= ymax; - - % if one of the bounding condition is not met, set edge to NaN - if ~(xOk && yOk) - edge (i,:) = NaN; - end -end - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipPoints.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipPoints.m 2011-10-06 18:57:03 UTC (rev 8691) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipPoints.m 2011-10-06 20:48:58 UTC (rev 8692) @@ -1,63 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISC... [truncated message content] |
From: <jpi...@us...> - 2011-10-06 21:42:03
|
Revision: 8695 http://octave.svn.sourceforge.net/octave/?rev=8695&view=rev Author: jpicarbajal Date: 2011-10-06 21:41:54 +0000 (Thu, 06 Oct 2011) Log Message: ----------- geometry. Finish adding boxes and clips Modified Paths: -------------- trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/doc/NEWS Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/inst/clipRay.m trunk/octave-forge/main/geometry/geom2d/inst/intersectBoxes.m trunk/octave-forge/main/geometry/geom2d/inst/intersectLines.m trunk/octave-forge/main/geometry/geom2d/inst/linePosition.m trunk/octave-forge/main/geometry/geom2d/inst/mergeBoxes.m trunk/octave-forge/main/geometry/geom2d/inst/randomPointInBox.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipRay.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectBoxes.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectLines.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testLinePosition.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testMergeBoxes.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectBoxes.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLines.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/linePosition.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/mergeBoxes.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/randomPointInBox.m Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2011-10-06 21:37:42 UTC (rev 8694) +++ trunk/octave-forge/main/geometry/INDEX 2011-10-06 21:41:54 UTC (rev 8695) @@ -14,6 +14,12 @@ rad2deg vectorAngle cbezier2poly + boxes2d + clipEdge + clipLine + clipPoints + drawBezierCurve + drawBox Input svgload svgnormalize Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-10-06 21:37:42 UTC (rev 8694) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-10-06 21:41:54 UTC (rev 8695) @@ -32,9 +32,16 @@ vectorAngle.m =============================================================================== -geometry-1.2 Release Date: 2011-10-xx Release Manager: Juan Pablo Carbajal +geometry-1.1.1 Release Date: 2011-10-xx Release Manager: Juan Pablo Carbajal =============================================================================== -* Continue to add geom2d from matGeom +* Continue to add geom2d from matGeom (boxes and clips) cbezier2poly.m + boxes2d.m + clipEdge.m + clipLine.m + clipPoints.m + drawBezierCurve.m + drawBox.m + =============================================================================== Copied: trunk/octave-forge/main/geometry/geom2d/inst/clipRay.m (from rev 8692, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipRay.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/clipRay.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/clipRay.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -0,0 +1,172 @@ +%% Copyright (c) 2011, INRA +%% 2010-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {[@var{edge} @var{inside}] =} clipRay (@var{ray}, @var{box}) +%% Clip a ray with a box. +%% +%% @var{ray} is a straight ray given as a 4 element row vector: [x0 y0 dx dy], +%% with (x0 y0) being the origin of the ray and (dx dy) its direction +%% vector, @var{box} is the clipping box, given by its extreme coordinates: +%% [xmin xmax ymin ymax]. +%% The result is given as an edge, defined by the coordinates of its 2 +%% extreme points: [x1 y1 x2 y2]. +%% If the ray does not intersect the box, [NaN NaN NaN NaN] is returned. +%% +%% Function works also if @var{ray} is a Nx4 array, if @var{box} is a Nx4 array, or +%% if both @var{ray} and @var{box} are Nx4 arrays. In these cases, @var{edge} is a Nx4 +%% array. +%% +%% @seealso{rays2d, boxes2d, edges2d, clipLine, drawRay} +%% @end deftypefn + +function [edge isInside] = clipRay(ray, bb) + + % adjust size of two input arguments + if size(ray, 1)==1 + ray = repmat(ray, size(bb, 1), 1); + elseif size(bb, 1)==1 + bb = repmat(bb, size(ray, 1), 1); + elseif size(ray, 1) != size(bb, 1) + error('bad sizes for input'); + end + + % first compute clipping of supporting line + edge = clipLine(ray, bb); + + % detectes valid edges (edges outside box are all NaN) + inds = find(isfinite(edge(:, 1))); + + % compute position of edge extremities relative to the ray + pos1 = linePosition(edge(inds,1:2), ray(inds,:)); + pos2 = linePosition(edge(inds,3:4), ray(inds,:)); + + % if first point is before ray origin, replace by origin + edge(inds(pos1<0), 1:2) = ray(inds(pos1<0), 1:2); + + % if last point of edge is before origin, set all edge to NaN + edge(inds(pos2<0), :) = NaN; + + % eventually returns result about inside or outside + if nargout>1 + isInside = isfinite(edge(:,1)); + end + +endfunction + +%!shared bb +%! bb = [0 100 0 100]; + +%!test % inside +%! origin = [30 40]; +%! direction = [10 0]; +%! ray = [origin direction]; +%! expected = [30 40 100 40]; +%! assert (expected, clipRay(ray, bb), 1e-6); + +%!test % outside +%! origin = [30 140]; +%! direction = [10 0]; +%! ray = [origin direction]; +%! assert (sum(isnan(clipRay(ray, bb)))==4); + +%!test % line inside, but ray outside +%! origin = [130 40]; +%! direction = [10 0]; +%! ray = [origin direction]; +%! assert (sum(isnan(clipRay(ray, bb)))==4); + +%!test % inside +%! origin = [30 40]; +%! direction = [-10 0]; +%! ray = [origin direction]; +%! expected = [30 40 0 40]; +%! assert (expected, clipRay(ray, bb), 1e-6); + +%!test % outside +%! origin = [30 140]; +%! direction = [-10 0]; +%! ray = [origin direction]; +%! assert (sum(isnan(clipRay(ray, bb)))==4); + +%!test % line inside, but ray outside +%! origin = [-30 40]; +%! direction = [-10 0]; +%! ray = [origin direction]; +%! assert (sum(isnan(clipRay(ray, bb)))==4); + +%!test % inside +%! origin = [30 40]; +%! direction = [0 10]; +%! ray = [origin direction]; +%! expected = [30 40 30 100]; +%! assert (expected, clipRay(ray, bb), 1e-6); + +%!test % outside +%! origin = [130 40]; +%! direction = [0 10]; +%! ray = [origin direction]; +%! assert (sum(isnan(clipRay(ray, bb)))==4); + +%!test % line inside, but ray outside +%! origin = [30 140]; +%! direction = [0 10]; +%! ray = [origin direction]; +%! assert (sum(isnan(clipRay(ray, bb)))==4); + +%!test % inside +%! origin = [30 40]; +%! direction = [0 -10]; +%! ray = [origin direction]; +%! expected = [30 40 30 0]; +%! assert (expected, clipRay(ray, bb), 1e-6); + +%!test % outside +%! origin = [130 40]; +%! direction = [0 -10]; +%! ray = [origin direction]; +%! assert (sum(isnan(clipRay(ray, bb)))==4); + +%!test % line inside, but ray outside +%! origin = [30 -40]; +%! direction = [0 -10]; +%! ray = [origin direction]; +%! assert (sum(isnan(clipRay(ray, bb)))==4); + +%!test +%! origins = [30 40;30 40;30 140;130 40]; +%! directions = [10 0;0 10;10 0;0 10]; +%! rays = [origins directions]; +%! expected = [30 40 100 40;30 40 30 100;NaN NaN NaN NaN;NaN NaN NaN NaN]; +%! clipped = clipRay(rays, bb); +%! assert (expected, clipped, 1e-6); Copied: trunk/octave-forge/main/geometry/geom2d/inst/intersectBoxes.m (from rev 8687, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectBoxes.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/intersectBoxes.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/intersectBoxes.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -0,0 +1,76 @@ +%% Copyright (c) 2011, INRA +%% 2010-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{box} =} intersectBoxes (@var{box1}, @var{box2}) +%% Intersection of two bounding boxes. +%% +%% Example +%% +%% @example +%% box1 = [5 20 5 30]; +%% box2 = [0 15 0 15]; +%% intersectBoxes(box1, box2) +%% ans = +%% 5 15 5 15 +%% @end example +%% +%% @seealso{boxes2d, drawBox, mergeBoxes} +%% @end deftypefn + +function bb = intersectBoxes(box1, box2) + + % unify sizes of data + if size(box1,1) == 1 + box1 = repmat(box1, size(box2,1), 1); + elseif size(box2, 1) == 1 + box2 = repmat(box2, size(box1,1), 1); + elseif size(box1,1) != size(box2,1) + error('geom2d:Error',"Bad size for inputs.\n"); + end + + % compute extreme coords + mini = min(box1(:,[2 4]), box2(:,[2 4])); + maxi = max(box1(:,[1 3]), box2(:,[1 3])); + + % concatenate result into a new box structure + bb = [maxi(:,1) mini(:,1) maxi(:,2) mini(:,2)]; + +endfunction + +%!test +%! box1 = [5 20 10 25]; +%! box2 = [0 15 15 20]; +%! res = [5 15 15 20]; +%! bb = intersectBoxes(box1, box2); +%! assert (res, bb, 1e-6); Copied: trunk/octave-forge/main/geometry/geom2d/inst/intersectLines.m (from rev 8687, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLines.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/intersectLines.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/intersectLines.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -0,0 +1,178 @@ +%% Copyright (c) 2011, INRA +%% 2003-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{point} =} intersectLines (@var{line1}, @var{line2}) +%% @deftypefnx {Function File} {@var{point} =} intersectLines (@var{line1}, @var{line2},@var{eps}) +%% Return all intersection points of N lines in 2D. +%% +%% Returns the intersection point of lines @var{line1} and @var{line2}. +%% @var{line1} and @var{line2} are [1*4] +%% arrays, containing parametric representation of each line (in the form +%% [x0 y0 dx dy], see @code{createLine} for details). +%% +%% In case of colinear lines, returns [Inf Inf]. +%% In case of parallel but not colinear lines, returns [NaN NaN]. +%% +%% If each input is [N*4] array, the result is a [N*2] array containing +%% intersections of each couple of lines. +%% If one of the input has N rows and the other 1 row, the result is a +%% [N*2] array. +%% +%% A third input argument specifies the tolerance for detecting parallel lines. +%% Default is 1e-14. +%% +%% Example +%% +%% @example +%% line1 = createLine([0 0], [10 10]); +%% line2 = createLine([0 10], [10 0]); +%% point = intersectLines(line1, line2) +%% point = +%% 5 5 +%% @end example +%% +%% @seealso{lines2d, edges2d, intersectEdges, intersectLineEdge, intersectLineCircle} +%% @end deftypefn + +function point = intersectLines(line1, line2, varargin) + + % extreact tolerance + tol = 1e-14; + if !isempty(varargin) + tol = varargin{1}; + end + + x1 = line1(:,1); + y1 = line1(:,2); + dx1 = line1(:,3); + dy1 = line1(:,4); + + x2 = line2(:,1); + y2 = line2(:,2); + dx2 = line2(:,3); + dy2 = line2(:,4); + + N1 = length(x1); + N2 = length(x2); + + % indices of parallel lines + par = abs(dx1.*dy2 - dx2.*dy1) < tol; + + % indices of colinear lines + col = abs((x2-x1) .* dy1 - (y2-y1) .* dx1) < tol & par ; + + x0(col) = Inf; + y0(col) = Inf; + x0(par & !col) = NaN; + y0(par & !col) = NaN; + + i = !par; + + % compute intersection points + if N1==N2 + x0(i) = ((y2(i)-y1(i)).*dx1(i).*dx2(i) + x1(i).*dy1(i).*dx2(i) - x2(i).*dy2(i).*dx1(i)) ./ ... + (dx2(i).*dy1(i)-dx1(i).*dy2(i)) ; + y0(i) = ((x2(i)-x1(i)).*dy1(i).*dy2(i) + y1(i).*dx1(i).*dy2(i) - y2(i).*dx2(i).*dy1(i)) ./ ... + (dx1(i).*dy2(i)-dx2(i).*dy1(i)) ; + + elseif N1==1 + x0(i) = ((y2(i)-y1).*dx1.*dx2(i) + x1.*dy1.*dx2(i) - x2(i).*dy2(i).*dx1) ./ ... + (dx2(i).*dy1-dx1.*dy2(i)) ; + y0(i) = ((x2(i)-x1).*dy1.*dy2(i) + y1.*dx1.*dy2(i) - y2(i).*dx2(i).*dy1) ./ ... + (dx1.*dy2(i)-dx2(i).*dy1) ; + + elseif N2==1 + x0(i) = ((y2-y1(i)).*dx1(i).*dx2 + x1(i).*dy1(i).*dx2 - x2.*dy2.*dx1(i)) ./ ... + (dx2.*dy1(i)-dx1(i).*dy2) ; + y0(i) = ((x2-x1(i)).*dy1(i).*dy2 + y1(i).*dx1(i).*dy2 - y2.*dx2.*dy1(i)) ./ ... + (dx1(i).*dy2-dx2.*dy1(i)) ; + + else + % formattage a rajouter + x0(i) = ((y2(i)-y1(i)).*dx1(i).*dx2(i) + x1(i).*dy1(i).*dx2(i) - x2(i).*dy2(i).*dx1(i)) ./ ... + (dx2(i).*dy1(i)-dx1(i).*dy2(i)) ; + y0(i) = ((x2(i)-x1(i)).*dy1(i).*dy2(i) + y1(i).*dx1(i).*dy2(i) - y2(i).*dx2(i).*dy1(i)) ./ ... + (dx1(i).*dy2(i)-dx2(i).*dy1(i)) ; + end + + % concatenate result + point = [x0' y0']; + +endfunction + +%!test % basic test with two orthogonal lines +%! line1 = [3 1 0 1]; +%! line2 = [1 4 1 0]; +%! assert (intersectLines(line1, line2), [3 4], 1e-6); + +%!test % orthognal diagonal lines +%! line1 = [0 0 3 2]; +%! line2 = [5 -1 4 -6]; +%! assert (intersectLines(line1, line2), [3 2], 1e-6); + +%!test % one diagonal and one horizontal line +%! line1 = [10 2 25 0]; +%! line2 = [5 -1 4 -6]; +%! assert (intersectLines(line1, line2), [3 2], 1e-6); + +%!test % check for dx and dy very big compared to other line +%! line1 = [3 1 0 1000]; +%! line2 = [1 4 -14 0]; +%! assert (intersectLines(line1, line2), [3 4], 1e-6); + +%!test +%! line1 = [2 0 20000 30000]; +%! line2 = [1 6 1 -1]; +%! assert (intersectLines(line1, line2), [4 3], 1e-6); + +%!test +%! line1 = [3 1 0 1]; +%! line2 = repmat([1 4 1 0], 5, 1); +%! res = repmat([3 4], 5, 1); +%! inters = intersectLines(line1, line2); +%! assert (res, inters, 1e-6); + +%!test +%! line1 = repmat([3 1 0 1], 5, 1); +%! line2 = [1 4 1 0]; +%! res = repmat([3 4], 5, 1); +%! inters = intersectLines(line1, line2); +%! assert (res, inters, 1e-6); + +%!test +%! line1 = repmat([3 1 0 1], 5, 1); +%! line2 = repmat([1 4 1 0], 5, 1); +%! res = repmat([3 4], 5, 1); +%! inters = intersectLines(line1, line2); +%! assert (res, inters, 1e-6); Copied: trunk/octave-forge/main/geometry/geom2d/inst/linePosition.m (from rev 8687, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/linePosition.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/linePosition.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/linePosition.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -0,0 +1,139 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PUR@var{pos}E +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% @var{pos}SIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{pos} =} linePosition (@var{point}, @var{line}) +%% Position of a point on a line. +%% +%% Computes position of point @var{point} on the line @var{line}, relative to origin +%% point and direction vector of the line. +%% @var{line} has the form [x0 y0 dx dy], +%% @var{point} has the form [x y], and is assumed to belong to line. +%% +%% If @var{line} is an array of NL lines, return NL positions, corresponding to +%% each line. +%% +%% If @var{point} is an array of NP points, return NP positions, corresponding +%% to each point. +%% +%% If @var{point} is an array of NP points and @var{line}S is an array of NL lines, +%% return an array of [NP NL] position, corresponding to each couple +%% point-line. +%% +%% Example +%% +%% @example +%% line = createLine([10 30], [30 90]); +%% linePosition([20 60], line) +%% ans = +%% .5 +%% @end example +%% +%% @seealso{lines2d, createLine, projPointOnLine, isPointOnLine} +%% @end deftypefn + +function d = linePosition(point, lin) + + % number of inputs + Nl = size(lin, 1); + Np = size(point, 1); + + if Np == Nl + % if both inputs have the same size, no problem + dxl = lin(:, 3); + dyl = lin(:, 4); + dxp = point(:, 1) - lin(:, 1); + dyp = point(:, 2) - lin(:, 2); + + elseif Np == 1 + % one point, several lines + dxl = lin(:, 3); + dyl = lin(:, 4); + dxp = point(ones(Nl, 1), 1) - lin(:, 1); + dyp = point(ones(Nl, 1), 2) - lin(:, 2); + + elseif Nl == 1 + % one lin, several points + dxl = lin(ones(Np, 1), 3); + dyl = lin(ones(Np, 1), 4); + dxp = point(:, 1) - lin(1); + dyp = point(:, 2) - lin(2); + + else + % expand one of the array to have the same size + dxl = repmat(lin(:,3)', Np, 1); + dyl = repmat(lin(:,4)', Np, 1); + dxp = repmat(point(:,1), 1, Nl) - repmat(lin(:,1)', Np, 1); + dyp = repmat(point(:,2), 1, Nl) - repmat(lin(:,2)', Np, 1); + end + + % compute position + d = (dxp.*dxl + dyp.*dyl) ./ (dxl.^2 + dyl.^2); + +endfunction + +%!demo +%! point = [20 60;10 30;25 75]; +%! lin = createLine([10 30], [30 90]); +%! pos = linePosition(point, lin) +%! +%! plot(point(:,1),point(:,2),'ok'); +%! hold on +%! drawLine(lin,'color','r'); +%! plot(lin(1)+lin(3)*pos,lin(2)+lin(4)*pos,'xb') +%! hold off + +%!test +%! point = [20 60]; +%! lin = createLine([10 30], [30 90]); +%! res = .5; +%! pos = linePosition(point, lin); +%! assert (res, pos); + +%!test +%! point = [20 60;10 30;25 75]; +%! lin = createLine([10 30], [30 90]); +%! res = [.5; 0; .75]; +%! pos = linePosition(point, lin); +%! assert (res, pos); + +%!test +%! point = [20 60]; +%! lin1 = createLine([10 30], [30 90]); +%! lin2 = createLine([0 0], [20 60]); +%! lin3 = createLine([20 60], [40 120]); +%! lines = [lin1;lin2;lin3]; +%! res = [.5; 1; 0]; +%! pos = linePosition(point, lines); +%! assert (res, pos); + Copied: trunk/octave-forge/main/geometry/geom2d/inst/mergeBoxes.m (from rev 8687, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/mergeBoxes.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/mergeBoxes.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/mergeBoxes.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -0,0 +1,77 @@ +%% Copyright (c) 2011, INRA +%% 2010-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{box} =} mergeBoxes (@var{box1}, @var{box2}) +%% Merge two boxes, by computing their greatest extent. +%% +% Example +%% +%% @example +%% box1 = [5 20 5 30]; +%% box2 = [0 15 0 15]; +%% mergeBoxes(box1, box2) +%% ans = +%% 0 20 0 30 +%% @end example +%% +%% @seealso{boxes2d, drawBox, intersectBoxes} +%% @end deftypefn + +function bb = mergeBoxes(box1, box2) + + % unify sizes of data + if size(box1,1) == 1 + box1 = repmat(box1, size(box2,1), 1); + elseif size(box2, 1) == 1 + box2 = repmat(box2, size(box1,1), 1); + elseif size(box1,1) != size(box2,1) + error('geom2d:Error', 'Bad size for inputs'); + end + + % compute extreme coords + mini = min(box1(:,[1 3]), box2(:,[1 3])); + maxi = max(box1(:,[2 4]), box2(:,[2 4])); + + % concatenate result into a new box structure + bb = [mini(:,1) maxi(:,1) mini(:,2) maxi(:,2)]; + +endfunction + +%!test +%! box1 = [5 20 10 25]; +%! box2 = [0 15 15 20]; +%! res = [0 20 10 25]; +%! bb = mergeBoxes(box1, box2); +%! assert (res, bb, 1e-6); + Copied: trunk/octave-forge/main/geometry/geom2d/inst/randomPointInBox.m (from rev 8687, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/randomPointInBox.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/randomPointInBox.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/randomPointInBox.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -0,0 +1,85 @@ +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{points} =} randomPointInBox (@var{box}) +%% @deftypefnx {Function File} {@var{points} =} randomPointInBox (@var{box}, @var{n}) +%% Generate random points within a box. +%% +%% Generate a random point within the box @var{box}. The result is a 1-by-2 row +%% vector. If @var{n} is given, generates @var{n} points. The result is a +%% @var{n}-by-2 array. +%% +%% Example +%% +%% @example +%% % draw points within a box +%% box = [10 80 20 60]; +%% pts = randomPointInBox(box, 500); +%% figure(1); clf; hold on; +%% drawBox(box); +%% drawPoint(pts, '.'); +%% axis('equal'); +%% axis([0 100 0 100]); +%% @end example +%% +%% @seealso{edges2d, boxes2d, clipLine} +%% @end deftypefn + +function points = randomPointInBox(box, N=1, varargin) + + % extract box bounds + xmin = box(1); + xmax = box(2); + ymin = box(3); + ymax = box(4); + + % compute size of box + dx = xmax - xmin; + dy = ymax - ymin; + + % compute point coordinates + points = [rand(N, 1)*dx+xmin , rand(N, 1)*dy+ymin]; + +endfunction + +%!demo +%! % draw points within a box +%! bb = [10 80 20 60]; +%! pts = randomPointInBox(bb, 500); +%! figure(1); clf; hold on; +%! drawBox(bb); +%! drawPoint(pts, '.'); +%! axis equal +%! axis([0 100 0 100]); + Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipRay.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipRay.m 2011-10-06 21:37:42 UTC (rev 8694) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testClipRay.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -1,131 +0,0 @@ -function test_suite = testClipRay(varargin) -% Tests the function 'clipRay' -% output = testClipRay(input) -% -% Example -% testClipRay -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - -function testRightSide -% test edges totally inside window, possibly touching edges - -% a basic bounding box -box = [0 100 0 100]; - -% inside -origin = [30 40]; -direction = [10 0]; -ray = [origin direction]; -expected = [30 40 100 40]; -assertElementsAlmostEqual(expected, clipRay(ray, box)); - -% outside -origin = [30 140]; -direction = [10 0]; -ray = [origin direction]; -assertTrue(sum(isnan(clipRay(ray, box)))==4); - -% line inside, but ray outside -origin = [130 40]; -direction = [10 0]; -ray = [origin direction]; -assertTrue(sum(isnan(clipRay(ray, box)))==4); - -function testLeftSide -% test edges totally inside window, possibly touching edges - -% a basic bounding box -box = [0 100 0 100]; - -% inside -origin = [30 40]; -direction = [-10 0]; -ray = [origin direction]; -expected = [30 40 0 40]; -assertElementsAlmostEqual(expected, clipRay(ray, box)); - -% outside -origin = [30 140]; -direction = [-10 0]; -ray = [origin direction]; -assertTrue(sum(isnan(clipRay(ray, box)))==4); - -% line inside, but ray outside -origin = [-30 40]; -direction = [-10 0]; -ray = [origin direction]; -assertTrue(sum(isnan(clipRay(ray, box)))==4); - - -function testUpSide -% test edges totally inside window, possibly touching edges - -box = [0 100 0 100]; - -% inside -origin = [30 40]; -direction = [0 10]; -ray = [origin direction]; -expected = [30 40 30 100]; -assertElementsAlmostEqual(expected, clipRay(ray, box)); - -% outside -origin = [130 40]; -direction = [0 10]; -ray = [origin direction]; -assertTrue(sum(isnan(clipRay(ray, box)))==4); - -% line inside, but ray outside -origin = [30 140]; -direction = [0 10]; -ray = [origin direction]; -assertTrue(sum(isnan(clipRay(ray, box)))==4); - - -function testDownSide -% test edges totally inside window, possibly touching edges - -box = [0 100 0 100]; - -% inside -origin = [30 40]; -direction = [0 -10]; -ray = [origin direction]; -expected = [30 40 30 0]; -assertElementsAlmostEqual(expected, clipRay(ray, box)); - -% outside -origin = [130 40]; -direction = [0 -10]; -ray = [origin direction]; -assertTrue(sum(isnan(clipRay(ray, box)))==4); - -% line inside, but ray outside -origin = [30 -40]; -direction = [0 -10]; -ray = [origin direction]; -assertTrue(sum(isnan(clipRay(ray, box)))==4); - - -function testArray -% test with an array of rays and a box - -box = [0 100 0 100]; - -origins = [30 40;30 40;30 140;130 40]; -directions = [10 0;0 10;10 0;0 10]; -rays = [origins directions]; -expected = [30 40 100 40;30 40 30 100;NaN NaN NaN NaN;NaN NaN NaN NaN]; -clipped = clipRay(rays, box); -assertElementsAlmostEqual(expected, clipped); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectBoxes.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectBoxes.m 2011-10-06 21:37:42 UTC (rev 8694) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectBoxes.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -1,26 +0,0 @@ -function test_suite = testIntersectBoxes(varargin) %#ok<STOUT> -%testIntersectBoxes One-line description here, please. -% -% output = testIntersectBoxes(input) -% -% Example -% testIntersectBoxes -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2010-08-06, using Matlab 7.9.0.529 (R2009b) -% Copyright 2010 INRA - Cepia Software Platform. - - -initTestSuite; - -function testBasic %#ok<*DEFNU> -box1 = [5 20 10 25]; -box2 = [0 15 15 20]; -exp = [5 15 15 20]; -box = intersectBoxes(box1, box2); -assertElementsAlmostEqual(exp, box); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectLines.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectLines.m 2011-10-06 21:37:42 UTC (rev 8694) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIntersectLines.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -1,76 +0,0 @@ -function test_suite = testIntersectLines(varargin) %#ok<STOUT> -%TESTINTERSECTLINES One-line description here, please. -% output = testIntersectLines(input) -% -% Example -% testIntersectLines -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - - -function testOrthogonal %#ok<*DEFNU> -% basic test with two orthogonal lines -line1 = [3 1 0 1]; -line2 = [1 4 1 0]; -assertElementsAlmostEqual(intersectLines(line1, line2), [3 4]); - -function testOrthogonalDiagonals -% orthognal diagonal lines -line1 = [0 0 3 2]; -line2 = [5 -1 4 -6]; -assertElementsAlmostEqual(intersectLines(line1, line2), [3 2]); - -function testDiagonalHorizontal -% one diagonal and one horizontal line -line1 = [10 2 25 0]; -line2 = [5 -1 4 -6]; -assertElementsAlmostEqual(intersectLines(line1, line2), [3 2]); - -function testBigDerivative -% check for dx and dy very big compared to other line -line1 = [3 1 0 1000]; -line2 = [1 4 -14 0]; -assertElementsAlmostEqual(intersectLines(line1, line2), [3 4]); - -line1 = [2 0 20000 30000]; -line2 = [1 6 1 -1]; -assertElementsAlmostEqual(intersectLines(line1, line2), [4 3]); - -function testSingleArray - -line1 = [3 1 0 1]; -line2 = repmat([1 4 1 0], 5, 1); -exp = repmat([3 4], 5, 1); - -inters = intersectLines(line1, line2); -assertElementsAlmostEqual(exp, inters); - - -function testArraySingle - -line1 = repmat([3 1 0 1], 5, 1); -line2 = [1 4 1 0]; -exp = repmat([3 4], 5, 1); - -inters = intersectLines(line1, line2); -assertElementsAlmostEqual(exp, inters); - - -function testArrayArray - -line1 = repmat([3 1 0 1], 5, 1); -line2 = repmat([1 4 1 0], 5, 1); -exp = repmat([3 4], 5, 1); - -inters = intersectLines(line1, line2); -assertElementsAlmostEqual(exp, inters); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testLinePosition.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testLinePosition.m 2011-10-06 21:37:42 UTC (rev 8694) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testLinePosition.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -1,55 +0,0 @@ -function test_suite = testLinePosition(varargin) %#ok<STOUT> -%TESTLINEPOSITION One-line description here, please. -% -% output = testLinePosition(input) -% -% Example -% testLinePosition -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2011-06-15, using Matlab 7.9.0.529 (R2009b) -% Copyright 2011 INRA - Cepia Software Platform. - - -initTestSuite; - -function testBasic %#ok<*DEFNU> - -point = [20 60]; -line = createLine([10 30], [30 90]); - -exp = .5; -pos = linePosition(point, line); - -assertEqual(exp, pos); - - -function testPointArray - -point = [20 60;10 30;25 75]; -line = createLine([10 30], [30 90]); - -exp = [.5; 0; .75]; -pos = linePosition(point, line); - -assertEqual(exp, pos); - - -function testLineArray - -point = [20 60]; -line1 = createLine([10 30], [30 90]); -line2 = createLine([0 0], [20 60]); -line3 = createLine([20 60], [40 120]); -lines = [line1;line2;line3]; - -exp = [.5; 1; 0]; -pos = linePosition(point, lines); - -assertEqual(exp, pos); - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testMergeBoxes.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testMergeBoxes.m 2011-10-06 21:37:42 UTC (rev 8694) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testMergeBoxes.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -1,26 +0,0 @@ -function test_suite = testMergeBoxes(varargin) %#ok<*STOUT> -%testMergeBoxes One-line description here, please. -% -% output = testMergeBoxes(input) -% -% Example -% testMergeBoxes -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2010-08-06, using Matlab 7.9.0.529 (R2009b) -% Copyright 2010 INRA - Cepia Software Platform. - - -initTestSuite; - -function testBasic %#ok<*DEFNU> -box1 = [5 20 10 25]; -box2 = [0 15 15 20]; -exp = [0 20 10 25]; -box = mergeBoxes(box1, box2); -assertElementsAlmostEqual(exp, box); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipRay.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipRay.m 2011-10-06 21:37:42 UTC (rev 8694) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/clipRay.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -1,86 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2010-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - -%% -*- texinfo -*- -%% @deftypefn {Function File} {[@var{edge} @var{inside}] =} clipRay (@var{ray}, @var{box}) -%% Clip a ray with a box. -%% -%% @var{ray} is a straight ray given as a 4 element row vector: [x0 y0 dx dy], -%% with (x0 y0) being the origin of the ray and (dx dy) its direction -%% vector, @var{box} is the clipping box, given by its extreme coordinates: -%% [xmin xmax ymin ymax]. -%% The result is given as an edge, defined by the coordinates of its 2 -%% extreme points: [x1 y1 x2 y2]. -%% If the ray does not intersect the box, [NaN NaN NaN NaN] is returned. -%% -%% Function works also if @var{ray} is a Nx4 array, if @var{box} is a Nx4 array, or -%% if both @var{ray} and @var{box} are Nx4 arrays. In these cases, @var{edge} is a Nx4 -%% array. -%% -%% @seealso{rays2d, boxes2d, edges2d, clipLine, drawRay} -%% @end deftypefn - -function [edge isInside] = clipRay(ray, box) - - % adjust size of two input arguments - if size(ray, 1)==1 - ray = repmat(ray, size(box, 1), 1); - elseif size(box, 1)==1 - box = repmat(box, size(ray, 1), 1); - elseif size(ray, 1) != size(box, 1) - error('bad sizes for input'); - end - - % first compute clipping of supporting line - edge = clipLine(ray, box); - - % detectes valid edges (edges outside box are all NaN) - inds = find(isfinite(edge(:, 1))); - - % compute position of edge extremities relative to the ray - pos1 = linePosition(edge(inds,1:2), ray(inds,:)); - pos2 = linePosition(edge(inds,3:4), ray(inds,:)); - - % if first point is before ray origin, replace by origin - edge(inds(pos1<0), 1:2) = ray(inds(pos1<0), 1:2); - - % if last point of edge is before origin, set all edge to NaN - edge(inds(pos2<0), :) = NaN; - - % eventually returns result about inside or outside - if nargout>1 - isInside = isfinite(edge(:,1)); - end - -endfunction - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectBoxes.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectBoxes.m 2011-10-06 21:37:42 UTC (rev 8694) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectBoxes.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -1,71 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function box = intersectBoxes(box1, box2) -%INTERSECTBOXES Intersection of two bounding boxes -% -% RES = intersectBoxes(BOX1, BOX2) -% -% Example -% box1 = [5 20 5 30]; -% box2 = [0 15 0 15]; -% intersectBoxes(box1, box2) -% ans = -% 5 15 5 15 -% -% See also -% boxes2d, drawBox, mergeBoxes -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2010-07-26, using Matlab 7.9.0.529 (R2009b) -% Copyright 2010 INRA - Cepia Software Platform. - -% unify sizes of data -if size(box1,1) == 1 - box1 = repmat(box1, size(box2,1), 1); -elseif size(box2, 1) == 1 - box2 = repmat(box2, size(box1,1), 1); -elseif size(box1,1) ~= size(box2,1) - error('Bad size for inputs'); -end - -% compute extreme coords -mini = min(box1(:,[2 4]), box2(:,[2 4])); -maxi = max(box1(:,[1 3]), box2(:,[1 3])); - -% concatenate result into a new box structure -box = [maxi(:,1) mini(:,1) maxi(:,2) mini(:,2)]; Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLines.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLines.m 2011-10-06 21:37:42 UTC (rev 8694) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/intersectLines.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -1,135 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function point = intersectLines(line1, line2, varargin) -%INTERSECTLINES Return all intersection points of N lines in 2D -% -% PT = intersectLines(L1, L2); -% returns the intersection point of lines L1 and L2. L1 and L2 are [1*4] -% arrays, containing parametric representation of each line (in the form -% [x0 y0 dx dy], see 'createLine' for details). -% -% In case of colinear lines, returns [Inf Inf]. -% In case of parallel but not colinear lines, returns [NaN NaN]. -% -% If each input is [N*4] array, the result is a [N*2] array containing -% intersections of each couple of lines. -% If one of the input has N rows and the other 1 row, the result is a -% [N*2] array. -% -% PT = intersectLines(L1, L2, EPS); -% Specifies the tolerance for detecting parallel lines. Default is 1e-14. -% -% Example -% line1 = createLine([0 0], [10 10]); -% line2 = createLine([0 10], [10 0]); -% point = intersectLines(line1, line2) -% point = -% 5 5 -% -% See also -% lines2d, edges2d, intersectEdges, intersectLineEdge -% intersectLineCircle -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 31/10/2003. -% - -% HISTORY -% 19/02/2004 add support for multiple lines. -% 08/03/2007 update doc - -% extreact tolerance -tol = 1e-14; -if ~isempty(varargin) - tol = varargin{1}; -end - -x1 = line1(:,1); -y1 = line1(:,2); -dx1 = line1(:,3); -dy1 = line1(:,4); - -x2 = line2(:,1); -y2 = line2(:,2); -dx2 = line2(:,3); -dy2 = line2(:,4); - -N1 = length(x1); -N2 = length(x2); - -% indices of parallel lines -par = abs(dx1.*dy2 - dx2.*dy1) < tol; - -% indices of colinear lines -col = abs((x2-x1) .* dy1 - (y2-y1) .* dx1) < tol & par ; - -x0(col) = Inf; -y0(col) = Inf; -x0(par & ~col) = NaN; -y0(par & ~col) = NaN; - -i = ~par; - -% compute intersection points -if N1==N2 - x0(i) = ((y2(i)-y1(i)).*dx1(i).*dx2(i) + x1(i).*dy1(i).*dx2(i) - x2(i).*dy2(i).*dx1(i)) ./ ... - (dx2(i).*dy1(i)-dx1(i).*dy2(i)) ; - y0(i) = ((x2(i)-x1(i)).*dy1(i).*dy2(i) + y1(i).*dx1(i).*dy2(i) - y2(i).*dx2(i).*dy1(i)) ./ ... - (dx1(i).*dy2(i)-dx2(i).*dy1(i)) ; - -elseif N1==1 - x0(i) = ((y2(i)-y1).*dx1.*dx2(i) + x1.*dy1.*dx2(i) - x2(i).*dy2(i).*dx1) ./ ... - (dx2(i).*dy1-dx1.*dy2(i)) ; - y0(i) = ((x2(i)-x1).*dy1.*dy2(i) + y1.*dx1.*dy2(i) - y2(i).*dx2(i).*dy1) ./ ... - (dx1.*dy2(i)-dx2(i).*dy1) ; - -elseif N2==1 - x0(i) = ((y2-y1(i)).*dx1(i).*dx2 + x1(i).*dy1(i).*dx2 - x2.*dy2.*dx1(i)) ./ ... - (dx2.*dy1(i)-dx1(i).*dy2) ; - y0(i) = ((x2-x1(i)).*dy1(i).*dy2 + y1(i).*dx1(i).*dy2 - y2.*dx2.*dy1(i)) ./ ... - (dx1(i).*dy2-dx2.*dy1(i)) ; - -else - % formattage a rajouter - x0(i) = ((y2(i)-y1(i)).*dx1(i).*dx2(i) + x1(i).*dy1(i).*dx2(i) - x2(i).*dy2(i).*dx1(i)) ./ ... - (dx2(i).*dy1(i)-dx1(i).*dy2(i)) ; - y0(i) = ((x2(i)-x1(i)).*dy1(i).*dy2(i) + y1(i).*dx1(i).*dy2(i) - y2(i).*dx2(i).*dy1(i)) ./ ... - (dx1(i).*dy2(i)-dx2(i).*dy1(i)) ; -end - -% concatenate result -point = [x0' y0']; Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/linePosition.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/linePosition.m 2011-10-06 21:37:42 UTC (rev 8694) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/linePosition.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -1,112 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function d = linePosition(point, line) -%LINEPOSITION Position of a point on a line -% -% POS = linePosition(POINT, LINE); -% Computes position of point POINT on the line LINE, relative to origin -% point and direction vector of the line. -% LINE has the form [x0 y0 dx dy], -% POINT has the form [x y], and is assumed to belong to line. -% -% POS = linePosition(POINT, LINES); -% If LINES is an array of NL lines, return NL positions, corresponding to -% each line. -% -% POS = linePosition(POINTS, LINE); -% If POINTS is an array of NP points, return NP positions, corresponding -% to each point. -% -% POS = linePosition(POINTS, LINES); -% If POINTS is an array of NP points and LINES is an array of NL lines, -% return an array of [NP NL] position, corresponding to each couple -% point-line. -% -% Example -% line = createLine([10 30], [30 90]); -% linePosition([20 60], line) -% ans = -% .5 -% -% See also: -% lines2d, createLine, projPointOnLine, isPointOnLine -% -% --------- -% -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 25/05/2004. -% - -% HISTORY -% 2005-07-07 manage multiple input -% 2011-06-15 avoid the use of repmat when possible - -% number of inputs -Nl = size(line, 1); -Np = size(point, 1); - -if Np == Nl - % if both inputs have the same size, no problem - dxl = line(:, 3); - dyl = line(:, 4); - dxp = point(:, 1) - line(:, 1); - dyp = point(:, 2) - line(:, 2); - -elseif Np == 1 - % one point, several lines - dxl = line(:, 3); - dyl = line(:, 4); - dxp = point(ones(Nl, 1), 1) - line(:, 1); - dyp = point(ones(Nl, 1), 2) - line(:, 2); - -elseif Nl == 1 - % one line, several points - dxl = line(ones(Np, 1), 3); - dyl = line(ones(Np, 1), 4); - dxp = point(:, 1) - line(1); - dyp = point(:, 2) - line(2); - -else - % expand one of the array to have the same size - dxl = repmat(line(:,3)', Np, 1); - dyl = repmat(line(:,4)', Np, 1); - dxp = repmat(point(:,1), 1, Nl) - repmat(line(:,1)', Np, 1); - dyp = repmat(point(:,2), 1, Nl) - repmat(line(:,2)', Np, 1); -end - -% compute position -d = (dxp.*dxl + dyp.*dyl) ./ (dxl.^2 + dyl.^2); - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/mergeBoxes.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/mergeBoxes.m 2011-10-06 21:37:42 UTC (rev 8694) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/mergeBoxes.m 2011-10-06 21:41:54 UTC (rev 8695) @@ -1,72 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function box = mergeBoxes(box1, box2) -%MERGEBOXES Merge two boxes, by computing their greatest extent -% -% BOX = mergeBoxes(BOX1, BOX2); -% -% Example -% box1 = [5 20 5 30]; -% box2 = [0 15 0 15]; -% mergeBoxes(box1, box2) -% ans = -% 0 20 0 30 -% -% -% See also -% boxes2d, drawBox, intersectBoxes -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2010-07-26, using Matlab 7.9.0.529 (R2009b) -% Copyright 2010 INRA - Cepia Software Platform. - -% unify sizes of data -if size(box1,1) == 1 - box1 = repmat(box1, size(box2,1), 1); -elseif size(box2, 1) =... [truncated message content] |
From: <jpi...@us...> - 2011-10-06 21:49:04
|
Revision: 8696 http://octave.svn.sourceforge.net/octave/?rev=8696&view=rev Author: jpicarbajal Date: 2011-10-06 21:48:57 +0000 (Thu, 06 Oct 2011) Log Message: ----------- geometry. Adding drawLine Modified Paths: -------------- trunk/octave-forge/main/geometry/doc/NEWS Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/inst/drawLine.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLine.m Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-10-06 21:41:54 UTC (rev 8695) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-10-06 21:48:57 UTC (rev 8696) @@ -43,5 +43,11 @@ clipPoints.m drawBezierCurve.m drawBox.m - + clipRay.m + intersectBoxes.m + intersectLines.m + linePosition.m + mergeBoxes.m + randomPointInBox.m + drawLine.m =============================================================================== Copied: trunk/octave-forge/main/geometry/geom2d/inst/drawLine.m (from rev 8687, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLine.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/drawLine.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/drawLine.m 2011-10-06 21:48:57 UTC (rev 8696) @@ -0,0 +1,87 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{h} =} drawLine (@var{line}) +%% @deftypefnx {Function File} {@var{h} =} drawLine (@var{line}, @var{param},@var{value}) +%% Draw the line on the current axis. +%% +%% Draws the line LINE on the current axis, by using current axis to clip +%% the line. Extra @var{param},@var{value} pairs are passed to the @code{line} function. +%% Returns a handle to the created line object. If clipped line is not +%% contained in the axis, the function returns -1. +%% +%% Example +%% +%% @example +%% figure; hold on; axis equal; +%% axis([0 100 0 100]); +%% drawLine([30 40 10 20]); +%% drawLine([30 40 20 -10], 'color', 'm', 'linewidth', 2); +%% @ed example +%% +%% @seealso{lines2d, createLine, drawEdge} +%% @end deftypefn + +function varargout = drawLine(lin, varargin) + + % default style for drawing lines + varargin = [{'color', 'b'}, varargin]; + + % extract bounding box of the current axis + xlim = get(gca, 'xlim'); + ylim = get(gca, 'ylim'); + + % clip lines with current axis box + clip = clipLine(lin, [xlim ylim]); + ok = isfinite(clip(:,1)); + + % initialize result array to invalide handles + h = -1*ones(size(lin, 1), 1); + + % draw valid lines + h(ok) = line(clip(ok, [1 3])', clip(ok, [2 4])', varargin{:}); + + % return line handle if needed + if nargout>0 + varargout{1}=h; + end + +endfunction + +%!demo +%! figure; hold on; axis equal; +%! axis([0 100 0 100]); +%! drawLine([30 40 10 20]); +%! drawLine([30 40 20 -10], 'color', 'm', 'linewidth', 2); + Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLine.m 2011-10-06 21:41:54 UTC (rev 8695) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawLine.m 2011-10-06 21:48:57 UTC (rev 8696) @@ -1,90 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function varargout = drawLine(lin, varargin) -%DRAWLINE Draw the line on the current axis -% -% drawline(LINE); -% Draws the line LINE on the current axis, by using current axis to clip -% the line. -% -% drawline(LINE, PARAM, VALUE); -% Specifies drawing options. -% -% H = drawLine(...) -% Returns a handle to the created line object. If clipped line is not -% contained in the axis, the function returns -1. -% -% Example -% figure; hold on; axis equal; -% axis([0 100 0 100]); -% drawLine([30 40 10 20]); -% drawLine([30 40 20 -10], 'color', 'm', 'linewidth', 2); -% -% See also: -% lines2d, createLine, drawEdge -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 31/10/2003. -% - -% HISTORY -% 25/05/2004 add support for multiple lines (loop) -% 23/05/2005 add support for arguments -% 03/08/2010 bug for lines outside box (thanks to Reto Zingg) -% 04/08/2010 rewrite using clipLine - -% default style for drawing lines -varargin = [{'color', 'b'}, varargin]; - -% extract bounding box of the current axis -xlim = get(gca, 'xlim'); -ylim = get(gca, 'ylim'); - -% clip lines with current axis box -clip = clipLine(lin, [xlim ylim]); -ok = isfinite(clip(:,1)); - -% initialize result array to invalide handles -h = -1*ones(size(lin, 1), 1); - -% draw valid lines -h(ok) = line(clip(ok, [1 3])', clip(ok, [2 4])', varargin{:}); - -% return line handle if needed -if nargout>0 - varargout{1}=h; -end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-06 22:01:18
|
Revision: 8697 http://octave.svn.sourceforge.net/octave/?rev=8697&view=rev Author: jpicarbajal Date: 2011-10-06 22:01:10 +0000 (Thu, 06 Oct 2011) Log Message: ----------- geometry. Adding example svg Modified Paths: -------------- trunk/octave-forge/main/geometry/DESCRIPTION trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/doc/NEWS trunk/octave-forge/main/geometry/geom2d/inst/drawBezierCurve.m trunk/octave-forge/main/geometry/geom2d/inst/drawLine.m Added Paths: ----------- trunk/octave-forge/main/geometry/inst/drawing.svg trunk/octave-forge/main/geometry/inst/drawing2.svg trunk/octave-forge/main/geometry/inst/drawing3.svg Modified: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION 2011-10-06 21:48:57 UTC (rev 8696) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2011-10-06 22:01:10 UTC (rev 8697) @@ -1,6 +1,6 @@ Name: Geometry -Version: 1.2.0 -Date: 2011-10-xx +Version: 1.1.1 +Date: 2011-10-06 Author: David Legland <dav...@gr...>, Juan Pablo Carbajal <car...@if...> Maintainer: Juan Pablo Carbajal <car...@if...> Title: Computational Geometry Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2011-10-06 21:48:57 UTC (rev 8696) +++ trunk/octave-forge/main/geometry/INDEX 2011-10-06 22:01:10 UTC (rev 8697) @@ -20,6 +20,13 @@ clipPoints drawBezierCurve drawBox + clipRay + intersectBoxes + intersectLines + linePosition + mergeBoxes + randomPointInBox + drawLine Input svgload svgnormalize Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-10-06 21:48:57 UTC (rev 8696) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-10-06 22:01:10 UTC (rev 8697) @@ -32,7 +32,7 @@ vectorAngle.m =============================================================================== -geometry-1.1.1 Release Date: 2011-10-xx Release Manager: Juan Pablo Carbajal +geometry-1.1.1 Release Date: 2011-10-06 Release Manager: Juan Pablo Carbajal =============================================================================== * Continue to add geom2d from matGeom (boxes and clips) Modified: trunk/octave-forge/main/geometry/geom2d/inst/drawBezierCurve.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/drawBezierCurve.m 2011-10-06 21:48:57 UTC (rev 8696) +++ trunk/octave-forge/main/geometry/geom2d/inst/drawBezierCurve.m 2011-10-06 22:01:10 UTC (rev 8697) @@ -34,7 +34,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} drawBezierCurve (@var{points}) %% @deftypefnx {Command} {Function File} drawBezierCurve (@var{pp}) -%% @deftypefnx {Command} {Function File} drawBezierCurve (@ldots, @var{param}, @var{value}, ...) +%% @deftypefnx {Command} {Function File} drawBezierCurve (..., @var{param}, @var{value}, ...) %% @deftypefnx {Command} {Function File} {@var{h} =}drawBezierCurve (...) %% Draw a cubic bezier curve defined by the control points @var{points}. %% Modified: trunk/octave-forge/main/geometry/geom2d/inst/drawLine.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/drawLine.m 2011-10-06 21:48:57 UTC (rev 8696) +++ trunk/octave-forge/main/geometry/geom2d/inst/drawLine.m 2011-10-06 22:01:10 UTC (rev 8697) @@ -48,7 +48,7 @@ %% axis([0 100 0 100]); %% drawLine([30 40 10 20]); %% drawLine([30 40 20 -10], 'color', 'm', 'linewidth', 2); -%% @ed example +%% @end example %% %% @seealso{lines2d, createLine, drawEdge} %% @end deftypefn Added: trunk/octave-forge/main/geometry/inst/drawing.svg =================================================================== --- trunk/octave-forge/main/geometry/inst/drawing.svg (rev 0) +++ trunk/octave-forge/main/geometry/inst/drawing.svg 2011-10-06 22:01:10 UTC (rev 8697) @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="744.09448" + height="1052.3622" + id="svg2"> + <defs + id="defs4" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <path + d="M 454.28571,522.36218 390.86384,658.59578 321.30892,525.38901 172.14463,507.16973 277.33815,399.85592 248.57141,252.36218 c 0,0 84.49011,68.02306 134.56809,66.88318 50.07797,-1.13988 90.20153,-101.44976 131.38547,-72.93685 41.18394,28.51291 -22.02586,148.64989 -22.02586,148.64989 l 109.96741,102.41628 z" + id="path2985" + style="fill:none;stroke:#000000" /> + <g + id="g2989"> + <path + d="m 150.51428,680.01932 -13.37143,59.35955 -13.37143,-59.35955 -59.359547,-13.37143 59.359547,-13.37143 13.37143,-59.35955 13.37143,59.35955 59.35955,13.37143 z" + id="path3006" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0" /> + <path + d="M 136.45714,80.70504 103.56449,80.720755 93.385152,49.442837 119.98663,30.096305 146.60659,49.41741 z" + id="path3008" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0" /> + </g> +</svg> Added: trunk/octave-forge/main/geometry/inst/drawing2.svg =================================================================== --- trunk/octave-forge/main/geometry/inst/drawing2.svg (rev 0) +++ trunk/octave-forge/main/geometry/inst/drawing2.svg 2011-10-06 22:01:10 UTC (rev 8697) @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="744.09448" + height="1052.3622" + id="svg2"> + <defs + id="defs4" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + id="layer1"> + <path + d="M 96.974644,325.05235 L 288.90363,215.95588 478.81231,415.96608 296.98485,521.02194 305.06607,367.47876 222.23356,359.39754 84.852814,401.82394 z" + id="path2985" + style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /> + <path + d="m 292.94424,56.351773 224.25386,26.263967 -16.16244,117.17769 -86.87312,-8.08122 34.34519,-56.56854 -80.8122,-6.06091 -123.23861,28.28427 z" + id="path2987" + style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /> + <path + d="M 446.48742,739.21489 333.35034,628.09811 123.23861,745.27581 64.649763,945.28601 214.15234,769.51947 m 58.58885,157.5838 117.17769,-105.05587 -80.8122,-44.44671 64.64976,-48.48732 139.40105,145.46196 20.20305,-129.29952 z" + id="path2989" + style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /> + </g> +</svg> Added: trunk/octave-forge/main/geometry/inst/drawing3.svg =================================================================== --- trunk/octave-forge/main/geometry/inst/drawing3.svg (rev 0) +++ trunk/octave-forge/main/geometry/inst/drawing3.svg 2011-10-06 22:01:10 UTC (rev 8697) @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + version="1.1" + width="744.09448" + height="1052.3622" + id="svg2"> + <defs + id="defs4" /> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + id="layer1"> + <path + d="M 74.285714,489.50504 C 237.9415,-167.46345 673.34728,1081.7548 631.42857,492.36218" + id="path2985" + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" /> + </g> +</svg> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-06 23:01:29
|
Revision: 8698 http://octave.svn.sourceforge.net/octave/?rev=8698&view=rev Author: jpicarbajal Date: 2011-10-06 23:01:22 +0000 (Thu, 06 Oct 2011) Log Message: ----------- geometry. Working on new shape of svg class Modified Paths: -------------- trunk/octave-forge/main/geometry/devel/@svg/svg.m trunk/octave-forge/main/geometry/inst/private/getSVGPaths_py.m trunk/octave-forge/main/geometry/inst/private/parsePath.py Modified: trunk/octave-forge/main/geometry/devel/@svg/svg.m =================================================================== --- trunk/octave-forge/main/geometry/devel/@svg/svg.m 2011-10-06 22:01:10 UTC (rev 8697) +++ trunk/octave-forge/main/geometry/devel/@svg/svg.m 2011-10-06 23:01:22 UTC (rev 8698) @@ -40,7 +40,7 @@ ## SVG paths. It is a vector of path structs. Maybe path can be a object too? ## Order of Path.Data is important so we store in a cell (could be a matrix padded with zeros). ## All the paths stored in polyval compatible format. Straigth segments are also stored as a polynomial. - svg.Path = struct('data',cell(),'id','null','unparsed',' '); + svg.Path = struct(); ## SVG paths. All the paths of the svg svg = class (svg, 'svg'); Modified: trunk/octave-forge/main/geometry/inst/private/getSVGPaths_py.m =================================================================== --- trunk/octave-forge/main/geometry/inst/private/getSVGPaths_py.m 2011-10-06 22:01:10 UTC (rev 8697) +++ trunk/octave-forge/main/geometry/inst/private/getSVGPaths_py.m 2011-10-06 23:01:22 UTC (rev 8698) @@ -13,30 +13,30 @@ %% You should have received a copy of the GNU General Public License %% along with this program. If not, see <http://www.gnu.org/licenses/>. -function paths = getSVGPaths_py (svg, varargin) +function Paths = getSVGPaths_py (svg, varargin) %% Call python script [st str]=system (sprintf ('python parsePath.py %s', svg)); %% Parse ouput - strs = strsplit (str(1:end-1), '$', true); + strpath = strsplit (str(1:end-1), '$', true); - npaths = numel (strs); - paths = cell(npaths,1); + npaths = numel (strpath); + %% Convert path data to polygons for ip = 1:npaths - eval (strs{ip}); + eval (strpath{ip}); %% FIXME: intialize struct with cell field svgpath2.cmd = svgpath(1).cmd; svgpath2.data = {svgpath.data}; nD = length(svgpath2.cmd); - paths{ip} = cell (nD-1,1); + pathdata = cell (nD-1,1); point_end=[]; + %% If the path is closed, last command is Z and we set initial point == final if svgpath2.cmd(end) == 'Z' - paths{ip}(nD-1) = []; nD -= 1; point_end = svgpath2.data{1}; end @@ -61,7 +61,7 @@ points(1,:) = [polyval(pp(1,:),1) polyval(pp(2,:),1)]; end - paths{ip}{jp-1} = pp; + pathdata{jp-1} = pp; end if ~isempty(point_end) @@ -69,24 +69,33 @@ points(2,:) = point_end; pp = [(points(2,:)-points(1,:))' points(1,:)']; - paths{ip}{end} = pp; + pathdata{end} = pp; end + Paths.(svgpathid).data = pathdata; end - endfunction %!test %! figure(1) %! hold on %! paths = getSVGPaths_py ('../drawing.svg'); +%! +%! % Get path ids +%! ids = fieldnames(paths); +%! npath = numel(ids); +%! %! t = linspace (0, 1, 64); -%! for i = 1:numel(paths) +%! +%! for i = 1:npath %! x = []; y = []; -%! for j = 1:numel(paths{i}) -%! x = cat (2, x, polyval (paths{i}{j}(1,:),t)); -%! y = cat (2, y, polyval (paths{i}{j}(2,:),t)); +%! data = paths.(ids(i)).data; +%! +%! for j = 1:numel(data) +%! x = cat (2, x, polyval (data{j}(1,:),t)); +%! y = cat (2, y, polyval (data{j}(2,:),t)); %! end +%! %! plot(x,y,'-'); %! end %! axis ij Modified: trunk/octave-forge/main/geometry/inst/private/parsePath.py =================================================================== --- trunk/octave-forge/main/geometry/inst/private/parsePath.py 2011-10-06 22:01:10 UTC (rev 8697) +++ trunk/octave-forge/main/geometry/inst/private/parsePath.py 2011-10-06 23:01:22 UTC (rev 8698) @@ -18,8 +18,13 @@ cmdlst.append(cmd) parlst.append(params) - print 'svgpath = struct("cmd","{0}","data",{{{1}}});$' \ + print 'svgpath = struct("cmd","{0}","data",{{{1}}});' \ .format(''.join(cmdlst),str(parlst).replace('[[','[').replace(']]',']')) + + print 'svgpathid = "{0}"; $'.format(path.attrib['id']) + + + # ---------------------------- if __name__=="__main__": This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-06 23:38:57
|
Revision: 8699 http://octave.svn.sourceforge.net/octave/?rev=8699&view=rev Author: jpicarbajal Date: 2011-10-06 23:38:49 +0000 (Thu, 06 Oct 2011) Log Message: ----------- geomtry. Working on class svg Modified Paths: -------------- trunk/octave-forge/main/geometry/devel/@svg/svg.m trunk/octave-forge/main/geometry/inst/private/getSVGPaths_py.m Added Paths: ----------- trunk/octave-forge/main/geometry/devel/@svg/inkex.py trunk/octave-forge/main/geometry/devel/@svg/loadpaths.m trunk/octave-forge/main/geometry/devel/@svg/parsePath.py trunk/octave-forge/main/geometry/devel/@svg/simplepath.py Copied: trunk/octave-forge/main/geometry/devel/@svg/inkex.py (from rev 8697, trunk/octave-forge/main/geometry/inst/private/inkex.py) =================================================================== --- trunk/octave-forge/main/geometry/devel/@svg/inkex.py (rev 0) +++ trunk/octave-forge/main/geometry/devel/@svg/inkex.py 2011-10-06 23:38:49 UTC (rev 8699) @@ -0,0 +1,235 @@ +#!/usr/bin/env python +""" +inkex.py +A helper module for creating Inkscape extensions + +Copyright (C) 2005,2007 Aaron Spike, aa...@ek... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +""" +import sys, copy, optparse, random, re +import gettext +from math import * +_ = gettext.gettext + +#a dictionary of all of the xmlns prefixes in a standard inkscape doc +NSS = { +u'sodipodi' :u'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd', +u'cc' :u'http://creativecommons.org/ns#', +u'ccOLD' :u'http://web.resource.org/cc/', +u'svg' :u'http://www.w3.org/2000/svg', +u'dc' :u'http://purl.org/dc/elements/1.1/', +u'rdf' :u'http://www.w3.org/1999/02/22-rdf-syntax-ns#', +u'inkscape' :u'http://www.inkscape.org/namespaces/inkscape', +u'xlink' :u'http://www.w3.org/1999/xlink', +u'xml' :u'http://www.w3.org/XML/1998/namespace' +} + +#a dictionary of unit to user unit conversion factors +uuconv = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'm':3543.3070866, + 'km':3543307.0866, 'pc':15.0, 'yd':3240 , 'ft':1080} +def unittouu(string): + '''Returns userunits given a string representation of units in another system''' + unit = re.compile('(%s)$' % '|'.join(uuconv.keys())) + param = re.compile(r'(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)') + + p = param.match(string) + u = unit.search(string) + if p: + retval = float(p.string[p.start():p.end()]) + else: + retval = 0.0 + if u: + try: + return retval * uuconv[u.string[u.start():u.end()]] + except KeyError: + pass + return retval + +def uutounit(val, unit): + return val/uuconv[unit] + +try: + from lxml import etree +except: + sys.exit(_('The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension. Please download and install the latest version from http://cheeseshop.python.org/pypi/lxml/, or install it through your package manager by a command like: sudo apt-get install python-lxml')) + +def debug(what): + sys.stderr.write(str(what) + "\n") + return what + +def errormsg(msg): + """Intended for end-user-visible error messages. + + (Currently just writes to stderr with an appended newline, but could do + something better in future: e.g. could add markup to distinguish error + messages from status messages or debugging output.) + + Note that this should always be combined with translation: + + import gettext + _ = gettext.gettext + ... + inkex.errormsg(_("This extension requires two selected paths.")) + """ + sys.stderr.write((unicode(msg) + "\n").encode("UTF-8")) + +def check_inkbool(option, opt, value): + if str(value).capitalize() == 'True': + return True + elif str(value).capitalize() == 'False': + return False + else: + raise optparse.OptionValueError("option %s: invalid inkbool value: %s" % (opt, value)) + +def addNS(tag, ns=None): + val = tag + if ns!=None and len(ns)>0 and NSS.has_key(ns) and len(tag)>0 and tag[0]!='{': + val = "{%s}%s" % (NSS[ns], tag) + return val + +class InkOption(optparse.Option): + TYPES = optparse.Option.TYPES + ("inkbool",) + TYPE_CHECKER = copy.copy(optparse.Option.TYPE_CHECKER) + TYPE_CHECKER["inkbool"] = check_inkbool + +class Effect: + """A class for creating Inkscape SVG Effects""" + + def __init__(self, *args, **kwargs): + self.document=None + self.ctx=None + self.selected={} + self.doc_ids={} + self.options=None + self.args=None + self.OptionParser = optparse.OptionParser(usage="usage: %prog [options] SVGfile",option_class=InkOption) + self.OptionParser.add_option("--id", + action="append", type="string", dest="ids", default=[], + help="id attribute of object to manipulate") + + def effect(self): + pass + + def getoptions(self,args=sys.argv[1:]): + """Collect command line arguments""" + self.options, self.args = self.OptionParser.parse_args(args) + + def parse(self,file=None): + """Parse document in specified file or on stdin""" + try: + try: + stream = open(file,'r') + except: + stream = open(self.svg_file,'r') + except: + stream = sys.stdin + self.document = etree.parse(stream) + stream.close() + + def getposinlayer(self): + #defaults + self.current_layer = self.document.getroot() + self.view_center = (0.0,0.0) + + layerattr = self.document.xpath('//sodipodi:namedview/@inkscape:current-layer', namespaces=NSS) + if layerattr: + layername = layerattr[0] + layer = self.document.xpath('//svg:g[@id="%s"]' % layername, namespaces=NSS) + if layer: + self.current_layer = layer[0] + + xattr = self.document.xpath('//sodipodi:namedview/@inkscape:cx', namespaces=NSS) + yattr = self.document.xpath('//sodipodi:namedview/@inkscape:cy', namespaces=NSS) + doc_height = unittouu(self.document.getroot().get('height')) + if xattr and yattr: + x = xattr[0] + y = yattr[0] + if x and y: + self.view_center = (float(x), doc_height - float(y)) # FIXME: y-coordinate flip, eliminate it when it's gone in Inkscape + + def getselected(self): + """Collect selected nodes""" + for i in self.options.ids: + path = '//*[@id="%s"]' % i + for node in self.document.xpath(path, namespaces=NSS): + self.selected[i] = node + + def getElementById(self, id): + path = '//*[@id="%s"]' % id + el_list = self.document.xpath(path, namespaces=NSS) + if el_list: + return el_list[0] + else: + return None + + def getParentNode(self, node): + for parent in self.document.getiterator(): + if node in parent.getchildren(): + return parent + break + + + def getdocids(self): + docIdNodes = self.document.xpath('//@id', namespaces=NSS) + for m in docIdNodes: + self.doc_ids[m] = 1 + + def getNamedView(self): + return self.document.xpath('//sodipodi:namedview', namespaces=NSS)[0] + + def createGuide(self, posX, posY, angle): + atts = { + 'position': str(posX)+','+str(posY), + 'orientation': str(sin(radians(angle)))+','+str(-cos(radians(angle))) + } + guide = etree.SubElement( + self.getNamedView(), + addNS('guide','sodipodi'), atts ) + return guide + + def output(self): + """Serialize document into XML on stdout""" + self.document.write(sys.stdout) + + def affect(self, args=sys.argv[1:], output=True): + """Affect an SVG document with a callback effect""" + self.svg_file = args[-1] + self.getoptions(args) + self.parse() + self.getposinlayer() + self.getselected() + self.getdocids() + self.effect() + if output: self.output() + + def uniqueId(self, old_id, make_new_id = True): + new_id = old_id + if make_new_id: + while new_id in self.doc_ids: + new_id += random.choice('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') + self.doc_ids[new_id] = 1 + return new_id + + def xpathSingle(self, path): + try: + retval = self.document.xpath(path, namespaces=NSS)[0] + except: + errormsg(_("No matching node for expression: %s") % path) + retval = None + return retval + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 Added: trunk/octave-forge/main/geometry/devel/@svg/loadpaths.m =================================================================== --- trunk/octave-forge/main/geometry/devel/@svg/loadpaths.m (rev 0) +++ trunk/octave-forge/main/geometry/devel/@svg/loadpaths.m 2011-10-06 23:38:49 UTC (rev 8699) @@ -0,0 +1,113 @@ +%% Copyright (c) 2011 Juan Pablo Carbajal <car...@if...> +%% +%% This program is free software: you can redistribute it and/or modify +%% it under the terms of the GNU General Public License as published by +%% the Free Software Foundation, either version 3 of the License, or +%% any later version. +%% +%% This program is distributed in the hope that it will be useful, +%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%% GNU General Public License for more details. +%% +%% You should have received a copy of the GNU General Public License +%% along with this program. If not, see <http://www.gnu.org/licenses/>. + +function Paths = loadpaths (svg, varargin) + + %% Call python script + if exist (name,'file') + % read from file + [st str]=system (sprintf ('python parsePath.py %s', svg)); + + else + % inline SVG + [st str]=system (sprintf ('python parsePath.py < %s', svg)); + end + + %% Parse ouput + strpath = strsplit (str(1:end-1), '$', true); + + npaths = numel (strpath); + + %% Convert path data to polygons + for ip = 1:npaths + + eval (strpath{ip}); + %% FIXME: intialize struct with cell field + svgpath2.cmd = svgpath(1).cmd; + svgpath2.data = {svgpath.data}; + + nD = length(svgpath2.cmd); + pathdata = cell (nD-1,1); + + point_end=[]; + %% If the path is closed, last command is Z and we set initial point == final + if svgpath2.cmd(end) == 'Z' + nD -= 1; + point_end = svgpath2.data{1}; + end + + %% Initial point + points(1,:) = svgpath2.data{1}; + + for jp = 2:nD + switch svgpath2.cmd(jp) + case 'L' + %% Straigth segment to polygon + points(2,:) = svgpath2.data{jp}; + pp = [(points(2,:)-points(1,:))' points(1,:)']; + clear points + points(1,:) = [polyval(pp(1,:),1) polyval(pp(2,:),1)]; + + case 'C' + %% Cubic bezier to polygon + points(2:4,:) = reshape (svgpath2.data{jp}, 2, 3).'; + pp = cbezier2poly (points); + clear points + points(1,:) = [polyval(pp(1,:),1) polyval(pp(2,:),1)]; + end + + pathdata{jp-1} = pp; + end + + if ~isempty(point_end) + %% Straight segmet to close the path + points(2,:) = point_end; + pp = [(points(2,:)-points(1,:))' points(1,:)']; + + pathdata{end} = pp; + end + + Paths.(svgpathid).data = pathdata; + end +endfunction + +%!test +%! figure(1) +%! hold on +%! paths = getSVGPaths_py ('../drawing.svg'); +%! +%! % Get path ids +%! ids = fieldnames(paths); +%! npath = numel(ids); +%! +%! t = linspace (0, 1, 64); +%! +%! for i = 1:npath +%! x = []; y = []; +%! data = paths.(ids(i)).data; +%! +%! for j = 1:numel(data) +%! x = cat (2, x, polyval (data{j}(1,:),t)); +%! y = cat (2, y, polyval (data{j}(2,:),t)); +%! end +%! +%! plot(x,y,'-'); +%! end +%! axis ij +%! if strcmpi(input('You should see drawing.svg [y/n] ','s'),'n') +%! error ("didn't get what was expected."); +%! end +%! close + Copied: trunk/octave-forge/main/geometry/devel/@svg/parsePath.py (from rev 8698, trunk/octave-forge/main/geometry/inst/private/parsePath.py) =================================================================== --- trunk/octave-forge/main/geometry/devel/@svg/parsePath.py (rev 0) +++ trunk/octave-forge/main/geometry/devel/@svg/parsePath.py 2011-10-06 23:38:49 UTC (rev 8699) @@ -0,0 +1,64 @@ +#!/usr/bin/env python + +import inkex, simplepath +import sys +#import getopt + +def parsePaths (filen=None): + + svg = inkex.Effect () + svg.parse (filen) + + paths = svg.document.xpath ('//svg:path', namespaces=inkex.NSS) + for path in paths: + D = simplepath.parsePath (path.attrib['d']) + cmdlst = []; + parlst = []; + for cmd,params in D: + cmdlst.append(cmd) + parlst.append(params) + + print 'svgpath = struct("cmd","{0}","data",{{{1}}});' \ + .format(''.join(cmdlst),str(parlst).replace('[[','[').replace(']]',']')) + + print 'svgpathid = "{0}"; $'.format(path.attrib['id']) + + + +# ---------------------------- + +if __name__=="__main__": + ''' + try: + optlist,args = getopt.getopt(sys.argv[1:],"thdp") + except getopt.GetoptError: + usage() + sys.exit(2) + + doHelp = 0 + c = Context() + c.doPrint = 1 + for opt in optlist: + if opt[0] == "-d": c.debug = 1 + if opt[0] == "-p": c.plot = 1 + if opt[0] == "-t": c.triangulate = 1 + if opt[0] == "-h": doHelp = 1 + + if not doHelp: + pts = [] + fp = sys.stdin + if len(args) > 0: + fp = open(args[0],'r') + for line in fp: + fld = line.split() + x = float(fld[0]) + y = float(fld[1]) + pts.append(Site(x,y)) + if len(args) > 0: fp.close() + + if doHelp or len(pts) == 0: + usage() + sys.exit(2) + ''' + svg = sys.argv[1] + parsePaths(svg) Copied: trunk/octave-forge/main/geometry/devel/@svg/simplepath.py (from rev 8697, trunk/octave-forge/main/geometry/inst/private/simplepath.py) =================================================================== --- trunk/octave-forge/main/geometry/devel/@svg/simplepath.py (rev 0) +++ trunk/octave-forge/main/geometry/devel/@svg/simplepath.py 2011-10-06 23:38:49 UTC (rev 8699) @@ -0,0 +1,212 @@ +#!/usr/bin/env python +""" +simplepath.py +functions for digesting paths into a simple list structure + +Copyright (C) 2005 Aaron Spike, aa...@ek... + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +""" +import re, math + +def lexPath(d): + """ + returns and iterator that breaks path data + identifies command and parameter tokens + """ + offset = 0 + length = len(d) + delim = re.compile(r'[ \t\r\n,]+') + command = re.compile(r'[MLHVCSQTAZmlhvcsqtaz]') + parameter = re.compile(r'(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)') + while 1: + m = delim.match(d, offset) + if m: + offset = m.end() + if offset >= length: + break + m = command.match(d, offset) + if m: + yield [d[offset:m.end()], True] + offset = m.end() + continue + m = parameter.match(d, offset) + if m: + yield [d[offset:m.end()], False] + offset = m.end() + continue + #TODO: create new exception + raise Exception, 'Invalid path data!' +''' +pathdefs = {commandfamily: + [ + implicitnext, + #params, + [casts,cast,cast], + [coord type,x,y,0] + ]} +''' +pathdefs = { + 'M':['L', 2, [float, float], ['x','y']], + 'L':['L', 2, [float, float], ['x','y']], + 'H':['H', 1, [float], ['x']], + 'V':['V', 1, [float], ['y']], + 'C':['C', 6, [float, float, float, float, float, float], ['x','y','x','y','x','y']], + 'S':['S', 4, [float, float, float, float], ['x','y','x','y']], + 'Q':['Q', 4, [float, float, float, float], ['x','y','x','y']], + 'T':['T', 2, [float, float], ['x','y']], + 'A':['A', 7, [float, float, float, int, int, float, float], ['r','r','a',0,'s','x','y']], + 'Z':['L', 0, [], []] + } +def parsePath(d): + """ + Parse SVG path and return an array of segments. + Removes all shorthand notation. + Converts coordinates to absolute. + """ + retval = [] + lexer = lexPath(d) + + pen = (0.0,0.0) + subPathStart = pen + lastControl = pen + lastCommand = '' + + while 1: + try: + token, isCommand = lexer.next() + except StopIteration: + break + params = [] + needParam = True + if isCommand: + if not lastCommand and token.upper() != 'M': + raise Exception, 'Invalid path, must begin with moveto.' + else: + command = token + else: + #command was omited + #use last command's implicit next command + needParam = False + if lastCommand: + if lastCommand.isupper(): + command = pathdefs[lastCommand][0] + else: + command = pathdefs[lastCommand.upper()][0].lower() + else: + raise Exception, 'Invalid path, no initial command.' + numParams = pathdefs[command.upper()][1] + while numParams > 0: + if needParam: + try: + token, isCommand = lexer.next() + if isCommand: + raise Exception, 'Invalid number of parameters' + except StopIteration: + raise Exception, 'Unexpected end of path' + cast = pathdefs[command.upper()][2][-numParams] + param = cast(token) + if command.islower(): + if pathdefs[command.upper()][3][-numParams]=='x': + param += pen[0] + elif pathdefs[command.upper()][3][-numParams]=='y': + param += pen[1] + params.append(param) + needParam = True + numParams -= 1 + #segment is now absolute so + outputCommand = command.upper() + + #Flesh out shortcut notation + if outputCommand in ('H','V'): + if outputCommand == 'H': + params.append(pen[1]) + if outputCommand == 'V': + params.insert(0,pen[0]) + outputCommand = 'L' + if outputCommand in ('S','T'): + params.insert(0,pen[1]+(pen[1]-lastControl[1])) + params.insert(0,pen[0]+(pen[0]-lastControl[0])) + if outputCommand == 'S': + outputCommand = 'C' + if outputCommand == 'T': + outputCommand = 'Q' + + #current values become "last" values + if outputCommand == 'M': + subPathStart = tuple(params[0:2]) + pen = subPathStart + if outputCommand == 'Z': + pen = subPathStart + else: + pen = tuple(params[-2:]) + + if outputCommand in ('Q','C'): + lastControl = tuple(params[-4:-2]) + else: + lastControl = pen + lastCommand = command + + retval.append([outputCommand,params]) + return retval + +def formatPath(a): + """Format SVG path data from an array""" + return "".join([cmd + " ".join([str(p) for p in params]) for cmd, params in a]) + +def translatePath(p, x, y): + for cmd,params in p: + defs = pathdefs[cmd] + for i in range(defs[1]): + if defs[3][i] == 'x': + params[i] += x + elif defs[3][i] == 'y': + params[i] += y + +def scalePath(p, x, y): + for cmd,params in p: + defs = pathdefs[cmd] + for i in range(defs[1]): + if defs[3][i] == 'x': + params[i] *= x + elif defs[3][i] == 'y': + params[i] *= y + elif defs[3][i] == 'r': # radius parameter + params[i] *= x + elif defs[3][i] == 's': # sweep-flag parameter + if x*y < 0: + params[i] = 1 - params[i] + elif defs[3][i] == 'a': # x-axis-rotation angle + if y < 0: + params[i] = - params[i] + +def rotatePath(p, a, cx = 0, cy = 0): + if a == 0: + return p + for cmd,params in p: + defs = pathdefs[cmd] + for i in range(defs[1]): + if defs[3][i] == 'x': + x = params[i] - cx + y = params[i + 1] - cy + r = math.sqrt((x**2) + (y**2)) + if r != 0: + theta = math.atan2(y, x) + a + params[i] = (r * math.cos(theta)) + cx + params[i + 1] = (r * math.sin(theta)) + cy + + +# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 encoding=utf-8 textwidth=99 Modified: trunk/octave-forge/main/geometry/devel/@svg/svg.m =================================================================== --- trunk/octave-forge/main/geometry/devel/@svg/svg.m 2011-10-06 23:01:22 UTC (rev 8698) +++ trunk/octave-forge/main/geometry/devel/@svg/svg.m 2011-10-06 23:38:49 UTC (rev 8699) @@ -16,19 +16,19 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {@var{obj} =} svg () +## @deftypefnx {Function File} {@var{obj} =} svg (@var{str}) ## Create object @var{obj} of the svn class. ## -## @seealso{@svn/plot} +## If no input argument is provided the object is empty. @var{str} can be a filename +## or a string defining an inline SVG. +## +## @seealso{@svn/parsePaths} ## @end deftypefn -function svg = svg +function svg = svg(name='') - if (nargin != 0) - print_usage ; - endif + svg = struct; - svg = struct; - ## SVG data. All the attributes of the <svg> node. ## The field unparsed contains all the attributes that are not being parsed. svg.Data = struct('height',[],'width',[],'id','null','unparsed',' '); @@ -45,4 +45,16 @@ ## SVG paths. All the paths of the svg svg = class (svg, 'svg'); + + if !isempty (name) + + paths = loadpaths(name); + svg.Path = paths; + + elseif !ischar(name) + + print_usage ; + + endif + endfunction Modified: trunk/octave-forge/main/geometry/inst/private/getSVGPaths_py.m =================================================================== --- trunk/octave-forge/main/geometry/inst/private/getSVGPaths_py.m 2011-10-06 23:01:22 UTC (rev 8698) +++ trunk/octave-forge/main/geometry/inst/private/getSVGPaths_py.m 2011-10-06 23:38:49 UTC (rev 8699) @@ -16,8 +16,15 @@ function Paths = getSVGPaths_py (svg, varargin) %% Call python script - [st str]=system (sprintf ('python parsePath.py %s', svg)); - + if exist (name,'file') + % read from file + [st str]=system (sprintf ('python parsePath.py %s', svg)); + + else + % inline SVG + [st str]=system (sprintf ('python parsePath.py < %s', svg)); + end + %% Parse ouput strpath = strsplit (str(1:end-1), '$', true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-07 00:38:58
|
Revision: 8706 http://octave.svn.sourceforge.net/octave/?rev=8706&view=rev Author: jpicarbajal Date: 2011-10-07 00:38:52 +0000 (Fri, 07 Oct 2011) Log Message: ----------- geometry. plot svg class Modified Paths: -------------- trunk/octave-forge/main/geometry/inst/private/getSVGPaths_py.m Added Paths: ----------- trunk/octave-forge/main/geometry/devel/@svg/plot.m Added: trunk/octave-forge/main/geometry/devel/@svg/plot.m =================================================================== --- trunk/octave-forge/main/geometry/devel/@svg/plot.m (rev 0) +++ trunk/octave-forge/main/geometry/devel/@svg/plot.m 2011-10-07 00:38:52 UTC (rev 8706) @@ -0,0 +1,45 @@ +## Copyright (C) 2011 Carnë Draug <car...@gm...> +## Copyright (c) 2011 Juan Pablo Carbajal <car...@if...> +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 3 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, see <http://www.gnu.org/licenses/>. + + +function plot(obj, varargin) + + % Get path ids + ids = fieldnames(obj.Path); + npath = numel(ids); + + t = linspace (0, 1, 64); + + for i = 1:npath + x = []; y = []; + data = obj.Path.(ids(i)).data; + + for j = 1:numel(data) + x = cat (2, x, polyval (data{j}(1,:),t)); + y = cat (2, y, polyval (data{j}(2,:),t)); + end + + plot(x,y,'-'); + if i == 1 + hold on + end + end + hold off + axis ij + axis equal + +endfunction + Modified: trunk/octave-forge/main/geometry/inst/private/getSVGPaths_py.m =================================================================== --- trunk/octave-forge/main/geometry/inst/private/getSVGPaths_py.m 2011-10-07 00:38:42 UTC (rev 8705) +++ trunk/octave-forge/main/geometry/inst/private/getSVGPaths_py.m 2011-10-07 00:38:52 UTC (rev 8706) @@ -16,7 +16,7 @@ function Paths = getSVGPaths_py (svg, varargin) %% Call python script - if exist (name,'file') + if exist (svg,'file') % read from file [st str]=system (sprintf ('python parsePath.py %s', svg)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-09 01:37:48
|
Revision: 8714 http://octave.svn.sourceforge.net/octave/?rev=8714&view=rev Author: jpicarbajal Date: 2011-10-09 01:37:39 +0000 (Sun, 09 Oct 2011) Log Message: ----------- geometry. Adding matgeom Rays and vectors Modified Paths: -------------- trunk/octave-forge/main/geometry/DESCRIPTION trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/doc/NEWS Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/inst/createRay.m trunk/octave-forge/main/geometry/geom2d/inst/drawEdge.m trunk/octave-forge/main/geometry/geom2d/inst/drawRay.m trunk/octave-forge/main/geometry/geom2d/inst/isParallel.m trunk/octave-forge/main/geometry/geom2d/inst/isPerpendicular.m trunk/octave-forge/main/geometry/geom2d/inst/isPointOnRay.m trunk/octave-forge/main/geometry/geom2d/inst/normalizeVector.m trunk/octave-forge/main/geometry/geom2d/inst/rays2d.m trunk/octave-forge/main/geometry/geom2d/inst/rotateVector.m trunk/octave-forge/main/geometry/geom2d/inst/transformVector.m trunk/octave-forge/main/geometry/geom2d/inst/vectorNorm.m trunk/octave-forge/main/geometry/geom2d/inst/vectors2d.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isParallel.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPerpendicular.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnRay.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rays2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rotateVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformVector.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorNorm.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectors2d.m Modified: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION 2011-10-08 12:59:54 UTC (rev 8713) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2011-10-09 01:37:39 UTC (rev 8714) @@ -1,5 +1,5 @@ Name: Geometry -Version: 1.1.1 +Version: 1.1.2 Date: 2011-10-06 Author: David Legland <dav...@gr...>, Juan Pablo Carbajal <car...@if...> Maintainer: Juan Pablo Carbajal <car...@if...> Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2011-10-08 12:59:54 UTC (rev 8713) +++ trunk/octave-forge/main/geometry/INDEX 2011-10-09 01:37:39 UTC (rev 8714) @@ -6,27 +6,32 @@ angleDiff angles2d angleSort - createLine - deg2rad - edgeAngle - lineAngle - normalizeAngle - rad2deg - vectorAngle + boxes2d cbezier2poly - boxes2d clipEdge clipLine clipPoints + clipRay + createLine + createRay + deg2rad drawBezierCurve drawBox - clipRay + drawEdge + drawLine + drawRay + edgeAngle intersectBoxes intersectLines + isPointOnRay + lineAngle linePosition mergeBoxes + normalizeAngle + rad2deg randomPointInBox - drawLine + rays2d + vectorAngle Input svgload svgnormalize @@ -36,5 +41,3 @@ Geometry 3D Graphs - - Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-10-08 12:59:54 UTC (rev 8713) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-10-09 01:37:39 UTC (rev 8714) @@ -50,4 +50,20 @@ mergeBoxes.m randomPointInBox.m drawLine.m + =============================================================================== +geometry-1.1.2 Release Date: 2011-10-xx Release Manager: Juan Pablo Carbajal +=============================================================================== + +* Continue to add geom2d from matGeom (rays and vectors) + createRay + drawRay + isPointOnRay + drawEdge + rays2d + vectors2d + vectorNorm + isParallel + isPerpendicular + +=============================================================================== Copied: trunk/octave-forge/main/geometry/geom2d/inst/createRay.m (from rev 8710, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRay.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/createRay.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/createRay.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -0,0 +1,104 @@ +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} { @var{ray} = } createRay (@var{point}, @var{angle}) +%% @deftypefnx {Function File} { @var{ray} = } createRay (@var{x0},@var{y0}, @var{angle}) +%% @deftypefnx {Function File} { @var{ray} = } createRay (@var{p1}, @var{p2}) +%% Create a ray (half-line), from various inputs. +%% +%% A Ray is represented in a parametric form: [x0 y0 dx dy]. +%% x = x0 + t*dx +%% y = y0 + t*dy; +%% for all t>0. +%% +%% @var{point} is a Nx2 array giving the starting point of the ray, and @var{angle} is the +%% orientation of the ray respect to the positive x-axis. The ray origin can be specified with 2 input arguments @var{x0},@var{y0}. +%% +%% If two points @var{p1}, @var{p2} are given, creates a ray starting from point @var{p1} and going in the direction of point +%% @var{p2}. +%% +%% Example +%% @example +%% origin = [3 4]; +%% theta = pi/6; +%% ray = createRay(origin, theta); +%% axis([0 10 0 10]); +%% drawRay(ray); +%% @end example +%% +%% @seealso{rays2d, createLine, points2d} +%% @end deftypefn + +function ray = createRay(varargin) + + if length(varargin)==2 + p0 = varargin{1}; + arg = varargin{2}; + if size(arg, 2)==1 + % second input is the ray angle + ray = [p0 cos(arg) sin(arg)]; + else + % second input is another point + ray = [p0 arg-p0]; + end + + elseif length(varargin)==3 + x = varargin{1}; + y = varargin{2}; + theta = varargin{3}; + ray = [x y cos(theta) sin(theta)]; + + else + error("Wrong number of arguments in 'createRay'. "); + end + +endfunction + +%!shared p1,p2,ray +%! p1 = [1 1]; +%! p2 = [2 3]; +%! ray = createRay(p1, p2); + +%!assert (p1, ray(1,1:2), 1e-6); +%!assert (p2-p1, ray(1,3:4), 1e-6); + +%!shared p1,p2,ray +%! p1 = [1 1;1 1]; +%! p2 = [2 3;2 4]; +%! ray = createRay(p1, p2); + +%!assert (2, size(ray, 1)); +%!assert (p1, ray(:,1:2), 1e-6); +%!assert (p2-p1, ray(:,3:4), 1e-6); + Copied: trunk/octave-forge/main/geometry/geom2d/inst/drawEdge.m (from rev 8710, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEdge.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/drawEdge.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/drawEdge.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -0,0 +1,164 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{h} = } drawEdge (@var{x1}, @var{y1}, @var{x2}, @var{y2}) +%% @deftypefnx {Function File} {@var{h} = } drawEdge ([@var{x1} @var{y1} @var{x2} @var{y2}]) +%% @deftypefnx {Function File} {@var{h} = } drawEdge ([@var{x1} @var{y1}], [@var{x2} @var{y2}]) +%% @deftypefnx {Function File} {@var{h} = } drawEdge (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}) +%% @deftypefnx {Function File} {@var{h} = } drawEdge ([@var{x1} @var{y1} @var{z1} @var{x2} @var{y2} @var{z2}]) +%% @deftypefnx {Function File} {@var{h} = } drawEdge ([@var{x1} @var{y1} @var{z1}], [@var{x2} @var{y2} @var{z2}]) +%% @deftypefnx {Function File} {@var{h} = } drawEdge (@dots, @var{opt}) +%% Draw an edge given by 2 points. +%% +%% Draw an edge between the points (x1 y1) and (x2 y2). Data can be bundled as an edge. +%% The function supports 3D edges. +%% Arguments can be single values or array of size [Nx1]. In this case, +%% the function draws multiple edges. +%% @var{opt}, being a set of pairwise options, can +%% specify color, line width and so on. These are passed to function @code{line}. +%% The function returns handle(s) to created edges(s). +%% +%% @seealso{edges2d, drawCenteredEdge, drawLine, line} +%% @end deftypefn + +function varargout = drawEdge(varargin) + + % separate edge and optional arguments + [edge options] = parseInputArguments(varargin{:}); + + % draw the edges + if size(edge, 2)==4 + h = drawEdge_2d(edge, options); + else + h = drawEdge_3d(edge, options); + end + + % eventually return handle to created edges + if nargout>0 + varargout{1}=h; + end + +endfunction + +function h = drawEdge_2d(edge, options) + + h = -1*ones(size(edge, 1), 1); + + for i=1:size(edge, 1) + if isnan(edge(i,1)) + continue; + end + h(i) = line(... + [edge(i, 1) edge(i, 3)], ... + [edge(i, 2) edge(i, 4)], options{:}); + end + +endfunction + +function h = drawEdge_3d(edge, options) + + h = -1*ones(size(edge, 1), 1); + + for i=1:size(edge, 1) + if isnan(edge(i,1)) + continue; + end + h(i) = line( ... + [edge(i, 1) edge(i, 4)], ... + [edge(i, 2) edge(i, 5)], ... + [edge(i, 3) edge(i, 6)], options{:}); + end + +endfunction + +function [edge options] = parseInputArguments(varargin) + + % default values for parameters + edge = []; + + % find the number of arguments defining edges + nbVal=0; + for i=1:nargin + if isnumeric(varargin{i}) + nbVal = nbVal+1; + else + % stop at the first non-numeric value + break; + end + end + + % extract drawing options + options = varargin(nbVal+1:end); + + % ensure drawing options have correct format + if length(options)==1 + options = [{'color'}, options]; + end + + % extract edges characteristics + if nbVal==1 + % all parameters in a single array + edge = varargin{1}; + + elseif nbVal==2 + % parameters are two points, or two arrays of points, of size N*2. + p1 = varargin{1}; + p2 = varargin{2}; + edge = [p1 p2]; + + elseif nbVal==4 + % parameters are 4 parameters of the edge : x1 y1 x2 and y2 + edge = [varargin{1} varargin{2} varargin{3} varargin{4}]; + + elseif nbVal==6 + % parameters are 6 parameters of the edge : x1 y1 z1 x2 y2 and z2 + edge = [varargin{1} varargin{2} varargin{3} varargin{4} varargin{5} varargin{6}]; + end + +endfunction + +%!demo +%! close +%! points = rand(4,4); +%! colorstr = 'rgbm'; +%! for i=1:4 +%! drawEdge (points(i,:),'color',colorstr(i),'linewidth',2); +%! end +%! axis tight; + +%!demo +%! close +%! drawEdge (rand(10,4),'linewidth',2); +%! axis tight; + Copied: trunk/octave-forge/main/geometry/geom2d/inst/drawRay.m (from rev 8710, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawRay.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/drawRay.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/drawRay.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -0,0 +1,66 @@ +%% Copyright (c) 2011, INRA +%% 2003-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{h} = } drawRay (@var{ray}) +%% @deftypefnx {Function File} {@var{h} = } drawRay (@var{ray}, @var{param}, @var{value}) +%% Draw a ray on the current axis. +%% +%% With @var{ray} having the syntax: [x0 y0 dx dy], draws the ray starting from +%% point (x0 y0) and going to direction (dx dy), clipped with the current +%% window axis. @var{param}, @var{value} pairs are passed to function @code{line}. +%% +%% @seealso{rays2d, drawLine, line} +%% @end deftypefn + +function varargout = drawRay(ray, varargin) + + % get bounding box limits + bb = axis(gca); + + % compute clipped shapes + [clipped isInside] = clipRay(ray, bb); + + % allocate memory for handle + h = -ones(size(ray, 1), 1); + + % draw visible rays + h(isInside) = drawEdge(clipped(isInside, :), varargin{:}); + + % process output + if nargout>0 + varargout = {h}; + end + +endfunction + Copied: trunk/octave-forge/main/geometry/geom2d/inst/isParallel.m (from rev 8713, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isParallel.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/isParallel.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/isParallel.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -0,0 +1,97 @@ +%% Copyright (c) 2011, INRA +%% 2006-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{b} = } isParallel (@var{v1}, @var{v2}) +%% @deftypefnx {Function File} {@var{b} = } isParallel (@var{v1}, @var{v2},@var{tol}) +%% Check parallelism of two vectors +%% +%% @var{v1} and @var{v2} are 2 row vectors of length Nd, Nd being the dimension, +%% returns @code{true} if the vectors are parallel, and @code{false} otherwise. +%% +%% Also works when @var{v1} and @var{v2} are two [NxNd] arrays with same number of +%% rows. In this case, return a [Nx1] array containing @code{true} at the positions +%% of parallel vectors. +%% +%% @var{tol} specifies the accuracy of numerical computation. Default value is 1e-14. +%% +%% Example +%% +%% @example +%% isParallel([1 2], [2 4]) +%% ans = +%% 1 +%% isParallel([1 2], [1 3]) +%% ans = +%% 0 +%% @end example +%% +%% @seealso{vectors2d, isPerpendicular, lines2d} +%% @end deftypefn + +%% FIXME or erase me +%% Also works when one of @var{v1} or @var{v2} is scalar and the other one is [NxNd] +%% array, in this case return [Nx1] results. + +function b = isParallel(v1, v2, varargin) + + % default accuracy + acc = 1e-14; + if ~isempty(varargin) + acc = abs(varargin{1}); + end + + % adapt size of inputs if needed + n1 = size(v1, 1); + n2 = size(v2, 1); + if n1 ~= n2 + if n1 == 1 + v1 = v1(ones(n2,1), :); + elseif n2 == 1 + v2 = v2(ones(n1,1), :); + end + end + + % performs computation + if size(v1, 2) == 2 + b = abs(v1(:, 1) .* v2(:, 2) - v1(:, 2) .* v2(:, 1)) < acc; + else + % computation in space + b = vectorNorm(cross(v1, v2, 2)) < acc; + end + +endfunction + +%!assert (isParallel ([1 2], [2 4])) +%!assert (!isParallel ([1 2], [1 3])) +%!error (isParallel (3, rand(4,2))) Copied: trunk/octave-forge/main/geometry/geom2d/inst/isPerpendicular.m (from rev 8713, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPerpendicular.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/isPerpendicular.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/isPerpendicular.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -0,0 +1,95 @@ +%% Copyright (c) 2011, INRA +%% 2006-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{b} = } isPerpendicular (@var{v1}, @var{v2}) +%% @deftypefnx {Function File} {@var{b} = } isPerpendicula (@var{v1}, @var{v2},@var{tol}) +%% heck orthogonality of two vectors. +%% +%% @var{v1} and @var{v2} are 2 row vectors of length Nd, Nd being the dimension, +%% returns @code{true} if the vectors are perpendicular, and @code{false} otherwise. +%% +%% Also works when @var{v1} and @var{v2} are two [NxNd] arrays with same number of +%% rows. In this case, return a [Nx1] array containing @code{true} at the positions +%% of parallel vectors. +%% +%% @var{tol} specifies the accuracy of numerical computation. Default value is 1e-14. +%% +%% Example +%% +%% @example +% isPerpendicular([1 2 0], [0 0 2]) +%% ans = +%% 1 +% isPerpendicular([1 2 1], [1 3 2]) +%% ans = +%% 0 +%% @end example +%% +%% @seealso{vectors2d, isParallel, lines2d} +%% @end deftypefn + +%% FIXME or erase me +%% Also works when one of @var{v1} or @var{v2} is scalar and the other one is [NxNd] +%% array, in this case return [Nx1] results. + +function b = isPerpendicular(v1, v2, varargin) + + % default accuracy + acc = 1e-14; + if ~isempty(varargin) + acc = abs(varargin{1}); + end + + % adapt size of inputs + n1 = size(v1, 1); + n2 = size(v2, 1); + if n1~=n2 + if n1==1 + v1 = v1(ones(n2, 1), :); + elseif n2==1 + v2 = v2(ones(n1, 1), :); + else + error('Inputs must either have same size, or one must be scalar'); + end + end + + % performs test + b = abs(dot(v1, v2, 2)) < acc; + +endfunction + +%!assert (isPerpendicular ([1 2 0], [0 0 2])) +%!assert (!isPerpendicular([1 2 1], [1 3 2])) +%!error (isPerpendicular(1, rand(4,3))) + Copied: trunk/octave-forge/main/geometry/geom2d/inst/isPointOnRay.m (from rev 8710, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isPointOnRay.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/isPointOnRay.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/isPointOnRay.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -0,0 +1,94 @@ +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{b} = } isPointOnRay (@var{point}, @var{ray}) +%% @deftypefnx {Function File} {@var{b} = } isPointOnRay (@var{point}, @var{ray}, @var{tol}) +%% Test if a point belongs to a ray +%% +%% @var{b} = isPointOnRay(@var{point}, @var{ray}); +%% Returns @code{true} if point @var{point} belongs to the ray @var{ray}. +%% @var{point} is given by [x y] and RAY by [x0 y0 dx dy]. @var{tol} gives the +%% tolerance for the calculations. +%% +%% @seealso{rays2d, points2d, isPointOnLine} +%% @end deftypefn + +function b = isPointOnRay(point, ray, varargin) + + % extract computation tolerance + tol = 1e-14; + if ~isempty(varargin) + tol = varargin{1}; + end + + % number of rays and points + Nr = size(ray, 1); + Np = size(point, 1); + + % if several rays or several points, adapt sizes of arrays + x0 = repmat(ray(:,1)', Np, 1); + y0 = repmat(ray(:,2)', Np, 1); + dx = repmat(ray(:,3)', Np, 1); + dy = repmat(ray(:,4)', Np, 1); + xp = repmat(point(:,1), 1, Nr); + yp = repmat(point(:,2), 1, Nr); + + % test if points belongs to the supporting line + b1 = abs ( (xp-x0).*dy - (yp-y0).*dx ) ./ hypot(dx, dy) < tol; + + % check if points lie the good direction on the rays + ind = abs (dx) > abs (dy); + t = zeros (size (b1)); + t(ind) = (xp(ind)-x0(ind))./dx(ind); + t(~ind) = (yp(~ind)-y0(~ind))./dy(~ind); + + % combine the two tests + b = b1 & (t >= 0); + +endfunction + +%!shared ray +%! p1 = [10 20]; +%! p2 = [80 20]; +%! ray = createRay (p1, p2); + +%!assert (isPointOnRay([10 20], ray)); +%!assert (isPointOnRay([80 20], ray)); +%!assert (isPointOnRay([50 20], ray)); +%!assert (isPointOnRay([50 20+1e-3], ray,1e-2)); +%!assert ( !isPointOnRay([50 20+1e-3], ray,1e-4)); +%!assert ( !isPointOnRay([9.99 20], ray)); +%!assert ( !isPointOnRay([80 20.01], ray)); +%!assert ( !isPointOnRay([50 21], ray)); +%!assert ( !isPointOnRay([79 19], ray)); Copied: trunk/octave-forge/main/geometry/geom2d/inst/normalizeVector.m (from rev 8713, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/normalizeVector.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/normalizeVector.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/normalizeVector.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -0,0 +1,72 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{vn} = } normalizeVector (@var{v}) +%% Normalize a vector to have norm equal to 1 +%% +%% Returns the normalization of vector @var{v}, such that ||@var{v}|| = 1. +%% @var{v} can be either a row or a column vector. +%% +%% When @var{v} is a MxN array, normalization is performed for each row of the +%% array. +%% +%% Example: +%% +%% @example +%% vn = normalizeVector([3 4]) +%% vn = +%% 0.6000 0.8000 +%% vectorNorm(vn) +%% ans = +%% 1 +%% @end example +%% +%% @seealso{vectors2d, vectorNorm} +%% @end deftypefn + +function vn = normalizeVector(v) + + dim = size(v); + + if dim(1)==1 || dim(2)==1 + vn = v / sqrt(sum(v.^2)); + else + %same as: vn = v./repmat(sqrt(sum(v.*v, 2)), [1 dim(2)]); + vn = bsxfun(@rdivide, v, sqrt(sum(v.^2, 2))); + end + +endfunction + +%!assert (1,vectorNorm (normalizeVector ([3 4]))) + Copied: trunk/octave-forge/main/geometry/geom2d/inst/rays2d.m (from rev 8710, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rays2d.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/rays2d.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/rays2d.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -0,0 +1,60 @@ +%% Copyright (c) 2011, INRA +%% 2008-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} rays2d () +%% Description of functions operating on planar rays +%% +%% A ray is defined by a point (its origin), and a vector (its +%% direction). The different parameters are bundled into a row vector: +%% @code{RAY = [x0 y0 dx dy];} +%% +%% The ray contains all the points (x,y) such that: +%% x = x0 + t*dx +%% y = y0 + t*dy; +%% for all t>0 +%% +%% Contrary to a (straight) line, the points located before the origin do +%% not belong to the ray. +%% However, as rays and lines have the same representation, some functions +%% working on lines are also working on rays (like @code{transformLine}). +%% +%% @seealso{points2d, vectors2d, lines2d, createRay, bisector, isPointOnRay, +%% clipRay, drawRay} +%% @end deftypefn + +function rays2d(varargin) + + help('rays2d'); + +endfunction Copied: trunk/octave-forge/main/geometry/geom2d/inst/rotateVector.m (from rev 8713, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/rotateVector.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/rotateVector.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/rotateVector.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -0,0 +1,64 @@ +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{vr} = } rotateVector (@var{v}, @var{theta}) +%% Rotate a vector by a given angle +%% +%% Rotate the vector @var{v} by an angle @var{theta}, given in radians. +%% +%% Example +%% +%% @example +%% rotateVector([1 0], pi/2) +%% ans = +%% 0 1 +%% @end example +%% +%% @seealso{vectors2d, transformVector, createRotation} +%% @end deftypefn + +function vr = rotateVector(v, angle) + + % precomputes angles + cot = cos(angle); + sit = sin(angle); + + % compute rotated coordinates + vr = [cot * v(:,1) - sit * v(:,2) , sit * v(:,1) + cot * v(:,2)]; + +endfunction + +%!assert ([0 1],rotateVector([1 0],pi/2), 1e-6) +%!assert (sqrt([0.5 0.5]),rotateVector([1 0],pi/4), 1e-6) + Copied: trunk/octave-forge/main/geometry/geom2d/inst/transformVector.m (from rev 8713, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformVector.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/transformVector.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/transformVector.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -0,0 +1,108 @@ +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{v2} = } transformVector (@var{v}, @var{T}) +%% @deftypefnx {Function File} {[@var{x2} @var{y2}] = } transformVector (@var{x},@var{y}, @var{T}) +%% Transform a vector with an affine transform +%% +%% @var{v} has the form [xv yv], and @var{T} is a [2x2], [2x3] or [3x3] +%% matrix, returns the vector transformed with affine transform @var{T}. +%% +%% Format of @var{T} can be one of : +%% @group +%% [a b] , [a b c] , or [a b c] +%% [d e] [d e f] [d e f] +%% [0 0 1] +%% @end group +%% +%% Also works when @var{v} is a [Nx2] array of double. In this case, @var{v2} has +%% the same size as @var{v}. +%% +%% Also works when @var{x} and @var{y} are arrays the same size. The function +%% transform each couple of (@var{x}, @var{y}), and return the result in +%% (@var{x2}, @var{y2}), which is the same size as (@var{x}, @var{y}). +%% +%% @seealso{vectors2d, transforms2d, rotateVector, transformPoint} +%% @end deftypefn + +function varargout = transformVector(varargin) + + if length(varargin)==2 + var = varargin{1}; + vx = var(:,1); + vy = var(:,2); + trans = varargin{2}; + elseif length(varargin)==3 + vx = varargin{1}; + vy = varargin{2}; + trans = varargin{3}; + else + error('wrong number of arguments in "transformVector"'); + end + + + % compute new position of vector + vx2 = vx*trans(1,1) + vy*trans(1,2); + vy2 = vx*trans(2,1) + vy*trans(2,2); + + if size(trans, 2) == 3 + vx2 = vx2 + trans(1,3); + vy2 = vy2 + trans(2,3); + end + + % format output + if nargout==0 || nargout==1 + varargout{1} = [vx2 vy2]; + elseif nargout==2 + varargout{1} = vx2; + varargout{2} = vy2; + end + +endfunction + +%!demo +%! t1 = [2 0 0; 0 2 0]; +%! t2 = [1 0 1; 0 1 1]; +%! t3 = [0.5 0 1; 0 0.5 1; 0 0 1]; +%! +%! triangle = [-0.5 -1/3; 0.5 -1/3; 0 2/3; -0.5 -1/3]; +%! tr1 = transformVector(triangle,t1); +%! tr2 = transformVector(triangle,t2); +%! tr3 = transformVector(triangle,t3); +%! +%! plot(triangle(:,1),triangle(:,2),'k-', ... +%! tr1(:,1),tr1(:,2),'g-;scaled up;', ... +%! tr2(:,1),tr2(:,2),'m-;translated;', ... +%! tr3(:,1),tr3(:,2),'b-;scaled down and translated;') + Copied: trunk/octave-forge/main/geometry/geom2d/inst/vectorNorm.m (from rev 8713, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectorNorm.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/vectorNorm.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/vectorNorm.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -0,0 +1,114 @@ +%% Copyright (c) 2011, INRA +%% 2007-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{nm} = } vectorNorm (@var{v}) +%% @deftypefnx {Function File} {@var{nm} = } vectorNorm (@var{v},@var{n}) +%% Compute norm of a vector, or of a set of vectors +%% +%% Without extra arguments, returns the euclidean norm of vector V. +%% Optional argument @var{n} specifies the norm to use. N can be any value +%% greater than 0. +%% @table +%% @item N=1 +%% City lock norm. +%% @item N=2 +%% Euclidean norm. +%% @item N=inf +%% Compute max coord. +%% @end table +%% +%% When @var{v} is a MxN array, compute norm for each vector of the array. +%% Vector are given as rows. Result is then a Mx1 array. +%% +%% Example +%% +%% @example +%% n1 = vectorNorm([3 4]) +%% n1 = +%% 5 +%% +%% n2 = vectorNorm([1, 10], inf) +%% n2 = +%% 10 +%% @end example +%% +%% @seealso{vectors2d, vectorAngle} +%% @end deftypefn + +function n = vectorNorm(v, varargin) + + % size of vector + dim = size(v); + + % extract the type of norm to compute + d = 2; + if ~isempty(varargin) + d = varargin{1}; + end + + if d==2 + % euclidean norm: sum of squared coordinates, and take square root + if dim(1)==1 || dim(2)==1 + n = sqrt(sum(v.*v)); + else + n = sqrt(sum(v.*v, 2)); + end + elseif d==1 + % absolute norm: sum of absolute coordinates + if dim(1)==1 || dim(2)==1 + n = sum(abs(v)); + else + n = sum(abs(v), 2); + end + elseif d==inf + % infinite norm: uses the maximal corodinate + if dim(1)==1 || dim(2)==1 + n = max(v); + else + n = max(v, [], 2); + end + else + % Other norms, use explicit but slower expression + if dim(1)==1 || dim(2)==1 + n = power(sum(power(v, d)), 1/d); + else + n = power(sum(power(v, d), 2), 1/d); + end + end + +endfunction + +%!assert (5, vectorNorm ([3 4])) +%!assert(10, vectorNorm ([1, 10], inf)) + Copied: trunk/octave-forge/main/geometry/geom2d/inst/vectors2d.m (from rev 8710, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/vectors2d.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/vectors2d.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/vectors2d.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -0,0 +1,54 @@ +%% Copyright (c) 2011, INRA +%% 2008-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} vectors2d () +%% Description of functions operating on plane vectors +%% +%% A vector is defined by its two cartesian coordinates, put into a row +%% vector of 2 elements: +%% @code{V = [vx vy];} +%% +%% Several vectors are stored in a matrix with two columns, one for the +%% x-coordinate, one for the y-coordinate. +%% @voce{VS = [vx1 vy1 ; vx2 vy2 ; vx3 vy3];} +%% +%% @seealso{vectorNorm, vectorAngle, isPerpendicular, isParallel, +%% normalizeVector, transformVector, rotateVector} +%% @end deftypefn + +function vectors2d + + help('vectors2d'); + +endfunction Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateRay.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateRay.m 2011-10-08 12:59:54 UTC (rev 8713) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateRay.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -1,38 +0,0 @@ -function test_suite = testCreateRay(varargin) -%testCreateRay One-line description here, please. -% output = testCreateRay(input) -% -% Example -% testCreateRay -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - -function testCreateRay2Points - -p1 = [1 1]; -p2 = [2 3]; -ray = createRay(p1, p2); - -assertElementsAlmostEqual(p1, ray(1,1:2)); -assertElementsAlmostEqual(p2-p1, ray(1,3:4)); - -function testCreateRay2Arrays - -p1 = [1 1;1 1]; -p2 = [2 3;2 4]; -ray = createRay(p1, p2); - -assertEqual(2, size(ray, 1)); -assertElementsAlmostEqual(p1, ray(:,1:2)); -assertElementsAlmostEqual(p2-p1, ray(:,3:4)); - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRay.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRay.m 2011-10-08 12:59:54 UTC (rev 8713) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRay.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -1,90 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function ray = createRay(varargin) -%CREATERAY Create a ray (half-line), from various inputs -% -% RAY = createRay(POINT, ANGLE) -% POINT is a N*2 array giving starting point of the ray, and ANGLE is the -% orientation of the ray. -% -% RAY = createRay(X0, Y0, ANGLE) -% Specify ray origin with 2 input arguments. -% -% RAY = createRay(P1, P2) -% Create a ray starting from point P1 and going in the direction of point -% P2. -% -% Ray is represented in a parametric form: [x0 y0 dx dy] -% x = x0 + t*dx -% y = y0 + t*dy; -% for all t>0 -% -% Example -% origin = [3 4]; -% theta = pi/6; -% ray = createRay(origin, theta); -% figure(1); clf; hold on; -% axis([0 10 0 10]); -% drawRay(ray); -% -% See also: -% rays2d, createLine, points2d -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2007-10-18 -% Copyright 2007 INRA - BIA PV Nantes - MIAJ Jouy-en-Josas. - -if length(varargin)==2 - p0 = varargin{1}; - arg = varargin{2}; - if size(arg, 2)==1 - % second input is the ray angle - ray = [p0 cos(arg) sin(arg)]; - else - % second input is another point - ray = [p0 arg-p0]; - end - -elseif length(varargin)==3 - x = varargin{1}; - y = varargin{2}; - theta = varargin{3}; - ray = [x y cos(theta) sin(theta)]; - -else - error('Wrong number of arguments in ''createRay'' '); -end Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEdge.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEdge.m 2011-10-08 12:59:54 UTC (rev 8713) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawEdge.m 2011-10-09 01:37:39 UTC (rev 8714) @@ -1,162 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function varargout = drawEdge(varargin) -%DRAWEDGE Draw an edge given by 2 points -% -% drawEdge(x1, y1, x2, y2); -% draw an edge between the points (x1 y1) and (x2 y2). -% -% drawEdge([x1 y1 x2 y2]) ; -% drawEdge([x1 y1], [x2 y2]); -% specify data either as bundled edge, or as 2 points -% -% The function supports 3D edges: -% drawEdge([x1 y1 z1 x2 y2 z2]); -% drawEdge([x1 y1 z1], [x2 y2 z2]); -% drawEdge(x1, y1, z1, x2, y2, z2); -% -% Arguments can be single values or array of size [N*1]. In this case, -% the function draws multiple edges. -% -% H = drawEdge(..., OPT), with OPT being a set of pairwise options, can -% specify color, line width and so on... -% -% H = drawEdge(...) return handle(s) to created edges(s) -% -% See also: -% edges2d, drawCenteredEdge, drawLine -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 31/10/2003. -% - -% HISTORY -% 19/02/2004 add support for arrays of edges. -% 31/03/2004 change format of edges to [P1 P2] and variants. -% 28/11/2004 add support for 3D edges -% 01/08/2005 add support for drawing options -% 31/05/2007 update doc, and code makeup -% 03/08/2010 re-organize code - -% separate edge and optional arguments -[edge options] = parseInputArguments(varargin{:}); - -% draw the edges -if size(edge, 2)==4 - h = drawEdge_2d(edge, options); -else - h = drawEdge_3d(edge, options); -end - -% eventually return handle to created edges -if nargout>0 - varargout{1}=h; -end - - -function h = drawEdge_2d(edge, options) - -h = -1*ones(size(edge, 1), 1); - -for i=1:size(edge, 1) - if isnan(edge(i,1)) - continue; - end - h(i) = line(... - [edge(i, 1) edge(i, 3)], ... - [edge(i, 2) edge(i, 4)], options{:}); -end - - -function h = drawEdge_3d(edge, options) - -h = -1*ones(size(edge, 1), 1); - -for i=1:size(edge, 1) - if isnan(edge(i,1)) - continue; - end - h(i) = line( ... - [edge(i, 1) edge(i, 4)], ... - [edge(i, 2) edge(i, 5)], ... - [edge(i, 3) edge(i, 6)], options{:}); -end - - -function [edge options] = parseInputArguments(varargin) - -% default values for parameters -edge = []; - -% find the number of arguments defining edges -nbVal=0; -for i=1:nargin - if isnumeric(varargin{i}) - nbVal = nbVal+1; - else - % stop at the first non-numeric value - break; - end -end - -% extract drawing options -options = varargin(nbVal+1:end); - -% ensure drawing options have correct format -if length(options)==1 - options = [{'color'}, options]; -end - -% extract edges characteristics -if nbVal==1 - % all parameters in a single array - edge = varargin{1}; - -elseif nbVal==2 - % parameters are two points, or two arrays of points, of size N*2. - p1 = varargin{1}; - p2 = varargin{2}; - edge = [p1 p2]; - -elseif nbVal==4 - % parameters are 4 parameters of the edge : x1 y1 x2 and y2 - edge = [varargin{1} varargin{2} varargin{3} varargin{4}]; - -elseif nbVal==6 - % parameters are 6 parameters of the edge : x1 y1 z1 x2 y2 and z2 - edge = [varargin... [truncated message content] |
From: <jpi...@us...> - 2011-10-09 16:20:54
|
Revision: 8717 http://octave.svn.sourceforge.net/octave/?rev=8717&view=rev Author: jpicarbajal Date: 2011-10-09 16:20:45 +0000 (Sun, 09 Oct 2011) Log Message: ----------- geometry. Adding transforms Modified Paths: -------------- trunk/octave-forge/main/geometry/DESCRIPTION trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/doc/NEWS trunk/octave-forge/main/geometry/geom2d/inst/angleDiff.m trunk/octave-forge/main/geometry/geom2d/inst/angleSort.m trunk/octave-forge/main/geometry/geom2d/inst/angles2d.m trunk/octave-forge/main/geometry/geom2d/inst/createLine.m trunk/octave-forge/main/geometry/geom2d/inst/deg2rad.m trunk/octave-forge/main/geometry/geom2d/inst/drawEdge.m trunk/octave-forge/main/geometry/geom2d/inst/edgeAngle.m trunk/octave-forge/main/geometry/geom2d/inst/lineAngle.m trunk/octave-forge/main/geometry/geom2d/inst/normalizeAngle.m trunk/octave-forge/main/geometry/geom2d/inst/rad2deg.m trunk/octave-forge/main/geometry/geom2d/inst/vectorAngle.m trunk/octave-forge/main/geometry/geom2d/inst/vectorNorm.m trunk/octave-forge/main/geometry/geom2d/inst/vectors2d.m trunk/octave-forge/main/geometry/inst/data2geo.m Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/inst/createBasisTransform.m trunk/octave-forge/main/geometry/geom2d/inst/createHomothecy.m trunk/octave-forge/main/geometry/geom2d/inst/createLineReflection.m trunk/octave-forge/main/geometry/geom2d/inst/createRotation.m trunk/octave-forge/main/geometry/geom2d/inst/createScaling.m trunk/octave-forge/main/geometry/geom2d/inst/createTranslation.m trunk/octave-forge/main/geometry/geom2d/inst/transformPoint.m trunk/octave-forge/main/geometry/geom2d/inst/transforms2d.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateRotation.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateScaling.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateTranslation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createBasisTransform.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createHomothecy.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLineReflection.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRotation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createScaling.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createTranslation.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transforms2d.m Modified: trunk/octave-forge/main/geometry/DESCRIPTION =================================================================== --- trunk/octave-forge/main/geometry/DESCRIPTION 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/DESCRIPTION 2011-10-09 16:20:45 UTC (rev 8717) @@ -1,6 +1,6 @@ Name: Geometry -Version: 1.1.2 -Date: 2011-10-06 +Version: 1.1.3 +Date: 2011-10-10 Author: David Legland <dav...@gr...>, Juan Pablo Carbajal <car...@if...> Maintainer: Juan Pablo Carbajal <car...@if...> Title: Computational Geometry Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/INDEX 2011-10-09 16:20:45 UTC (rev 8717) @@ -23,15 +23,22 @@ edgeAngle intersectBoxes intersectLines + isParallel + isPerpendicular isPointOnRay lineAngle linePosition mergeBoxes normalizeAngle + normalizeVector rad2deg randomPointInBox rays2d + rotateVector + transformVector vectorAngle + vectorNorm + vectors2d Input svgload svgnormalize @@ -41,3 +48,5 @@ Geometry 3D Graphs + + Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-10-09 16:20:45 UTC (rev 8717) @@ -52,18 +52,21 @@ drawLine.m =============================================================================== -geometry-1.1.2 Release Date: 2011-10-xx Release Manager: Juan Pablo Carbajal +geometry-1.1.2 Release Date: 2011-10-09 Release Manager: Juan Pablo Carbajal =============================================================================== * Continue to add geom2d from matGeom (rays and vectors) - createRay - drawRay - isPointOnRay - drawEdge - rays2d - vectors2d - vectorNorm - isParallel - isPerpendicular - + createRay.m + drawEdge.m + drawRay.m + isParallel.m + isPerpendicular.m + isPointOnRay.m + normalizeVector.m + rays2d.m + rotateVector.m + transformVector.m + vectorNorm.m + vectors2d.m + =============================================================================== Modified: trunk/octave-forge/main/geometry/geom2d/inst/angleDiff.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/angleDiff.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/angleDiff.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -33,7 +33,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{dif} =} angleDiff (@var{angle1}, @var{angle2}) -%% ANGLEDIFF Difference between two angles +%% Difference between two angles %% %% Computes the signed angular difference between two angles in radians. %% The result is comprised between -PI and +PI. Modified: trunk/octave-forge/main/geometry/geom2d/inst/angleSort.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/angleSort.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/angleSort.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -33,7 +33,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {varargout =} angleSort (@var{pts}, varargin) -%% ANGLESORT Sort points in the plane according to their angle to origin +%% Sort points in the plane according to their angle to origin %% %% %% PTS2 = angleSort(PTS); Modified: trunk/octave-forge/main/geometry/geom2d/inst/angles2d.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/angles2d.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/angles2d.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -33,7 +33,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} angles2d () -%% ANGLES2D Description of functions for manipulating angles +%% Description of functions for manipulating angles %% %% Angles are normalized in an interval of width 2*PI. Most geom2d %% functions return results in the [0 2*pi] interval, but it can be Copied: trunk/octave-forge/main/geometry/geom2d/inst/createBasisTransform.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createBasisTransform.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/createBasisTransform.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/createBasisTransform.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -0,0 +1,108 @@ +%% Copyright (c) 2011, INRA +%% 2010-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in @var{source} and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of @var{source} code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{T} = } createBasisTransfrom (@var{@var{target}}) +%% @deftypefnx {Function File} {@var{T} = } createBasisTransfrom (@var{@var{source}}, @var{@var{target}}) +%% Compute matrix for transforming a basis into another basis +%% +%% With only one input arguemnt, assumes the @var{source} is the standard (Oij) basis, with origin at (0,0), +%% first direction vector equal to (1,0) and second direction vector +%% equal to (0,1). Otherwise @var{@var{source}} specifies the @var{source} basis. +%% +%% Both @var{source} and @var{target} represent basis, in the following form: +%% [x0 y0 ex1 ey1 ex2 ey2] +%% [y0 y0] is the origin of the basis, [ex1 ey1] is the first direction +%% vector, and [ex2 ey2] is the second direction vector. +%% +%% The result @var{T} is a 3-by-3 matrix such that a point expressed with +%% coordinates of the first basis will be represented by new coordinates +%% @code{P2 = transformPoint(P1, @var{T})} in the @var{target} basis. +%% +%% Example +%% @example +%% % standard basis transform +%% src = [0 0 1 0 0 1]; +%% % @var{target} transform, just a rotation by atan(2/3) followed by a scaling +%% tgt = [0 0 .75 .5 -.5 .75]; +%% % compute transform +%% trans = createBasisTransform(src, tgt); +%% % transform the point (.25,1.25) into the point (1,1) +%% p1 = [.25 1.25]; +%% p2 = transformPoint(p1, trans) +%% ans = +%% 1 1 +%% @end example +%% +%% @seealso{transforms2d} +%% @end deftypefn + +function transfo = createBasisTransform(source, target) + + % init basis transform to identity + t1 = eye(3); + t2 = eye(3); + + if nargin==2 + % from source to reference basis + t1(1:2, 1) = source(3:4); + t1(1:2, 2) = source(5:6); + t1(1:2, 3) = source(1:2); + else + % if only one input, use first input as target basis, and leave the + % first matrix to identity + target = source; + end + + % from reference to target basis + t2(1:2, 1) = target(3:4); + t2(1:2, 2) = target(5:6); + t2(1:2, 3) = target(1:2); + + % compute transfo + % same as: transfo = inv(t2)*t1; + transfo = t2\t1; + +endfunction + +%!demo +%! % standard basis transform +%! src = [0 0 1 0 0 1]; +%! % target transform, just a rotation by atan(2/3) followed by a scaling +%! tgt = [0 0 .75 .5 -.5 .75]; +%! % compute transform +%! trans = createBasisTransform(src, tgt); +%! % transform the point (.25,1.25) into the point (1,1) +%! p1 = [.25 1.25]; +%! p2 = transformPoint(p1, trans) + Copied: trunk/octave-forge/main/geometry/geom2d/inst/createHomothecy.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createHomothecy.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/createHomothecy.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/createHomothecy.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -0,0 +1,61 @@ +%% Copyright (c) 2011, INRA +%% 2009-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{T} = } createHomothecy (@var{point}, @var{ratio}) +%% Create the the 3x3 matrix of an homothetic transform. +% +% @var{point} is the center of the homothecy, @var{ratio} is its factor. +% +% @seealso{transforms2d, transformPoint, createTranslation} +%% @end deftypefn + +function trans = createHomothecy(point, ratio) + + % extract coordinate of center + x0 = point(:,1); + y0 = point(:,2); + + % compute coefficients of the matrix + m00 = ratio; + m01 = 0; + m02 = x0*(1-ratio); + m10 = 0; + m11 = ratio; + m12 = y0*(1-ratio); + + % create transformation + trans = [m00 m01 m02; m10 m11 m12; 0 0 1]; + +endfunction + Modified: trunk/octave-forge/main/geometry/geom2d/inst/createLine.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/createLine.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/createLine.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -33,7 +33,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{line} =} createLine(varargin) -%% CREATELINE Create a straight line from 2 points, or from other inputs +%% Create a straight line from 2 points, or from other inputs %% %% Line is represented in a parametric form : [x0 y0 dx dy] %% x = x0 + t*dx Copied: trunk/octave-forge/main/geometry/geom2d/inst/createLineReflection.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLineReflection.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/createLineReflection.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/createLineReflection.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -0,0 +1,68 @@ +%% Copyright (c) 2011, INRA +%% 2009-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{T} = } function_name (@var{line}) +%% Create the the 3x3 matrix of a line reflection. +%% +%% Where @var{line} is given as [x0 y0 dx dy], return the affine tansform +%% corresponding to the desired line reflection. +%% +%% @seealso{lines2d, transforms2d, transformPoint, +%% createTranslation, createHomothecy, createScaling} +%% @end deftypefn + +function trans = createLineReflection(line) + + % extract line parameters + x0 = line(:,1); + y0 = line(:,2); + dx = line(:,3); + dy = line(:,4); + + % normalisation coefficient of line direction vector + delta = dx*dx + dy*dy; + + % compute coefficients of transform + m00 = (dx*dx - dy*dy)/delta; + m01 = 2*dx*dy/delta; + m02 = 2*dy*(dy*x0 - dx*y0)/delta; + m10 = 2*dx*dy/delta; + m11 = (dy*dy - dx*dx)/delta; + m12 = 2*dx*(dx*y0 - dy*x0)/delta; + + % create transformation + trans = [m00 m01 m02; m10 m11 m12; 0 0 1]; + +endfunction + Copied: trunk/octave-forge/main/geometry/geom2d/inst/createRotation.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRotation.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/createRotation.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/createRotation.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -0,0 +1,112 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{T} = } createRotation (@var{theta}) +%% @deftypefnx {Function File} {@var{T} = } createRotation (@var{point}, @var{theta}) +%% @deftypefnx {Function File} {@var{T} = } createRotation (@var{x0}, @var{y0}, @var{theta}) +%% Create the 3*3 matrix of a rotation. +%% +%% Returns the rotation corresponding to angle @var{theta} (in radians) +%% The returned matrix has the form : +%% [cos(theta) -sin(theta) 0] +%% [sin(theta) cos(theta) 0] +%% [0 0 1] +%% +%% @var{point} or (@var{x0},@var{y0}), specifies origin of rotation. The result is similar as performing +%% translation(-@var{x0},-@var{y0}), rotation(@var{theta}), and translation(@var{x0},@var{y0}). +%% +%% +%% @seealso{transforms2d, transformPoint, createTranslation, createScaling} +%% @end deftypefn + +function trans = createRotation(varargin) + + % default values + cx = 0; + cy = 0; + theta = 0; + + % get input values + if length(varargin)==1 + % only angle + theta = varargin{1}; + elseif length(varargin)==2 + % origin point (as array) and angle + var = varargin{1}; + cx = var(1); + cy = var(2); + theta = varargin{2}; + elseif length(varargin)==3 + % origin (x and y) and angle + cx = varargin{1}; + cy = varargin{2}; + theta = varargin{3}; + end + + % compute coefs + cot = cos(theta); + sit = sin(theta); + tx = cy*sit - cx*cot + cx; + ty = -cy*cot - cx*sit + cy; + + % create transformation matrix + trans = [cot -sit tx; sit cot ty; 0 0 1]; + +endfunction + +%!test +%! trans = createRotation(0); +%! assert (trans, [1 0 0;0 1 0;0 0 1], 1e-6); + +%!test +%! trans = createRotation(pi/2); +%! assert (trans, [0 -1 0; 1 0 0; 0 0 1], 1e-6); + +%!test +%! trans = createRotation(pi); +%! assert (trans, [-1 0 0;0 -1 0;0 0 1], 1e-6); + +%!test +%! trans = createRotation(3*pi/2); +%! assert (trans, [0 1 0; -1 0 0; 0 0 1], 1e-6); + +%!test +%! p0 = [3 5]; +%! theta = pi/3; +%! trans1 = createRotation(p0, theta); +%! t1 = createTranslation(-p0); +%! rot = createRotation(theta); +%! t2 = createTranslation(p0); +%! trans2 = t2*rot*t1; +%! assert (trans1, trans2, 1e-6); Copied: trunk/octave-forge/main/geometry/geom2d/inst/createScaling.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createScaling.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/createScaling.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/createScaling.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -0,0 +1,106 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{T} = } createScaling (@var{s}) +%% @deftypefnx {Function File} {@var{T} = } createScaling (@var{sx}, @var{sy}) +%% Create the 3x3 matrix of a scaling in 2 dimensions. +% +% Assume scaling @var{s} is equal n all directions unless @var{sx} and @var{sy} are given. +% Returns the matrix corresponding to scaling in the 2 main directions. +% The returned matrix has the form: +% [SX 0 0] +% [0 SY 0] +% [0 0 1] +% +% @seealso{transforms2d, transformPoint, createTranslation, createRotation} +%% @end deftypefn + +function trans = createScaling(varargin) + + % defined default arguments + sx = 1; + sy = 1; + cx = 0; + cy = 0; + + % process input arguments + if length(varargin)==1 + % the argument is either the scaling factor in both direction, + % or a 1x2 array containing scaling factor in each direction + var = varargin{1}; + sx = var(1); + sy = var(1); + if length(var)>1 + sy = var(2); + end + elseif length(varargin)==2 + % the 2 arguments are the scaling factors in each dimension + sx = varargin{1}; + sy = varargin{2}; + elseif length(varargin)==3 + % first argument is center, 2nd and 3d are scaling factors + center = varargin{1}; + cx = center(1); + cy = center(2); + sx = varargin{2}; + sy = varargin{3}; + end + + % create result matrix + trans = [sx 0 cx*(1-sx); 0 sy cy*(1-sy); 0 0 1]; + +endfunction + +%!test +%! trans = createScaling(2); +%! assert (trans, [2 0 0;0 2 0;0 0 1], 1e-6); + +%!test +%! trans = createScaling(2, 3); +%! assert (trans, [2 0 0;0 3 0;0 0 1], 1e-6); + +%!test +%! trans = createScaling([2 3]); +%! assert (trans, [2 0 0;0 3 0;0 0 1], 1e-6); + +%!test +%! sx = 2; +%! sy = 3; +%! p0 = [4 5]; +%! trans1 = createScaling(p0, sx, sy); +%! t1 = createTranslation(-p0); +%! sca = createScaling(sx, sy); +%! t2 = createTranslation(p0); +%! trans2 = t2*sca*t1; +%! assert (trans1, trans2, 1e-6); Copied: trunk/octave-forge/main/geometry/geom2d/inst/createTranslation.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createTranslation.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/createTranslation.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/createTranslation.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -0,0 +1,71 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{T} = } createTranslation (@var{vector}) +%% @deftypefnx {Function File} {@var{T} = } createTranslation (@var{dx},@var{dy}) +%% Create the 3*3 matrix of a translation. +%% +%% Returns the matrix corresponding to a translation by the vector [@var{dx} @var{dy}]. +%% The components can be given as two arguments. +%% The returned matrix has the form : +%% [1 0 TX] +%% [0 1 TY] +%% [0 0 1] +%% +%% @seealso{transforms2d, transformPoint, createRotation, createScaling} +%% @end deftypefn + +function trans = createTranslation(varargin) + + % process input arguments + if isempty(varargin) + tx = 0; + ty = 0; + elseif length(varargin)==1 + var = varargin{1}; + tx = var(1); + ty = var(2); + else + tx = varargin{1}; + ty = varargin{2}; + end + + % create the matrix representing the translation + trans = [1 0 tx ; 0 1 ty ; 0 0 1]; + +endfunction + +%!test +%! trans = createTranslation(2, 3); +%! assert (trans, [1 0 2;0 1 3;0 0 1], 1e-6); Modified: trunk/octave-forge/main/geometry/geom2d/inst/deg2rad.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/deg2rad.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/deg2rad.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -33,7 +33,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{rad} =} deg2rad(@var{deg}) -%% DEG2RAD Convert angle from degrees to radians +%% Convert angle from degrees to radians %% %% Usage: %% R = deg2rad(D) Modified: trunk/octave-forge/main/geometry/geom2d/inst/drawEdge.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/drawEdge.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/drawEdge.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -38,7 +38,7 @@ %% @deftypefnx {Function File} {@var{h} = } drawEdge (@var{x1}, @var{y1}, @var{z1}, @var{x2}, @var{y2}, @var{z2}) %% @deftypefnx {Function File} {@var{h} = } drawEdge ([@var{x1} @var{y1} @var{z1} @var{x2} @var{y2} @var{z2}]) %% @deftypefnx {Function File} {@var{h} = } drawEdge ([@var{x1} @var{y1} @var{z1}], [@var{x2} @var{y2} @var{z2}]) -%% @deftypefnx {Function File} {@var{h} = } drawEdge (@dots, @var{opt}) +%% @deftypefnx {Function File} {@var{h} = } drawEdge (@dots{}, @var{opt}) %% Draw an edge given by 2 points. %% %% Draw an edge between the points (x1 y1) and (x2 y2). Data can be bundled as an edge. Modified: trunk/octave-forge/main/geometry/geom2d/inst/edgeAngle.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/edgeAngle.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/edgeAngle.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -33,7 +33,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{theta} =} edgeAngle(@var{edge}) -%% EDGEANGLE Return angle of edge +%% Return angle of edge %% %% A = edgeAngle(EDGE) %% Returns the angle between horizontal, right-axis and the edge EDGE. Modified: trunk/octave-forge/main/geometry/geom2d/inst/lineAngle.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/lineAngle.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/lineAngle.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -33,7 +33,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{theta} =} lineAngle(varargin) -%% LINEANGLE Computes angle between two straight lines +%% Computes angle between two straight lines %% %% A = lineAngle(LINE); %% Returns the angle between horizontal, right-axis and the given line. Modified: trunk/octave-forge/main/geometry/geom2d/inst/normalizeAngle.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/normalizeAngle.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/normalizeAngle.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -34,7 +34,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{alpha2} =} normalizeAngle (@var{alpha}) %% @deftypefnx {Function File} {@var{alpha2} =} normalizeAngle (@var{alpha}, @var{center}) -%% NORMALIZEANGLE Normalize an angle value within a 2*PI interval +%% Normalize an angle value within a 2*PI interval %% %% ALPHA2 = normalizeAngle(ALPHA); %% ALPHA2 is the same as ALPHA modulo 2*PI and is positive. Modified: trunk/octave-forge/main/geometry/geom2d/inst/rad2deg.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/rad2deg.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/rad2deg.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -33,7 +33,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{deg} =} rad2deg(@var{rad}) -% RAD2DEG Convert angle from radians to degrees +% Convert angle from radians to degrees % % Usage: % R = rad2deg(D) Copied: trunk/octave-forge/main/geometry/geom2d/inst/transformPoint.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformPoint.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/transformPoint.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/transformPoint.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -0,0 +1,92 @@ +%% Copyright (c) 2011, INRA +%% 2005-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{pt2} = } transformPoint (@var{pt1}, @var{Trans}) +%% @deftypefnx {Function File} {[@var{px2} @var{py2}]= } transformPoint (@var{px1}, @var{py1}, @var{Trans}) +%% Transform a point with an affine transform. +%% +%% where @var{pt1} has the form [xp yp], and @var{Trans} is a [2x2], [2x3] or [3x3] +%% matrix, returns the point transformed with affine transform @var{Trans}. +%% +%% Format of @var{Trans} can be one of : +%% [a b] , [a b c] , or [a b c] +%% [d e] [d e f] [d e f] +%% [0 0 1] +%% +%% Also works when @var{pt1} is a [Nx2] array of double. In this case, @var{pt2} has +%% the same size as @var{pt1}. +%% +%% Also works when @var{px1} and @var{py1} are arrays the same size. The function +%% transform each couple of (@var{px1}, @var{py1}), and return the result in +%% (@var{px2}, @var{py2}), which is the same size as (@var{px1} @var{py1}). +%% +%% @seealso{points2d, transforms2d, createTranslation, createRotation} +%% @end deftypefn + +function varargout = transformPoint(varargin) + + if length(varargin)==2 + var = varargin{1}; + px = var(:,1); + py = var(:,2); + trans = varargin{2}; + elseif length(varargin)==3 + px = varargin{1}; + py = varargin{2}; + trans = varargin{3}; + else + error('wrong number of arguments in "transformPoint"'); + end + + + % compute position + px2 = px*trans(1,1) + py*trans(1,2); + py2 = px*trans(2,1) + py*trans(2,2); + + % add translation vector, if exist + if size(trans, 2)>2 + px2 = px2 + trans(1,3); + py2 = py2 + trans(2,3); + end + + + if nargout==0 || nargout==1 + varargout{1} = [px2 py2]; + elseif nargout==2 + varargout{1} = px2; + varargout{2} = py2; + end + +endfunction + Copied: trunk/octave-forge/main/geometry/geom2d/inst/transforms2d.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transforms2d.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/transforms2d.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/transforms2d.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -0,0 +1,63 @@ +%% Copyright (c) 2011, INRA +%% 2008-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} transforms2d () +%% Description of functions operating on transforms +%% +%% By 'transform' we mean an affine transform. A planar affine transform +%% can be represented by a 3x3 matrix. +%% +%% Example +%% +%% @example +%% % create a translation by the vector [10 20]: +%% T = createTranslation([10 20]) +%% T = +%% 1 0 10 +%% 0 1 20 +%% 0 0 1 +%%@end example +%% +%% @seealso{createTranslation, createRotation, createScaling, createBasisTransform, +%% createHomothecy, createLineReflection, fitAffineTransform2d, +%% transformPoint, transformVector, transformLine, transformEdge, +%% rotateVector} +%% @end deftypefn + +function transforms2d(varargin) + + help('transforms2d'); + +endfunction + Modified: trunk/octave-forge/main/geometry/geom2d/inst/vectorAngle.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/vectorAngle.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/vectorAngle.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -33,7 +33,7 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{alpha} =} vectorAngle (@var{v1}) -%% VECTORANGLE Angle of a vector, or between 2 vectors +%% Angle of a vector, or between 2 vectors %% %% A = vectorAngle(V); %% Returns angle between Ox axis and vector direction, in Counter Modified: trunk/octave-forge/main/geometry/geom2d/inst/vectorNorm.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/vectorNorm.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/vectorNorm.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -39,7 +39,7 @@ %% Without extra arguments, returns the euclidean norm of vector V. %% Optional argument @var{n} specifies the norm to use. N can be any value %% greater than 0. -%% @table +%% @table @samp %% @item N=1 %% City lock norm. %% @item N=2 Modified: trunk/octave-forge/main/geometry/geom2d/inst/vectors2d.m =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/vectors2d.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/geom2d/inst/vectors2d.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -41,7 +41,7 @@ %% %% Several vectors are stored in a matrix with two columns, one for the %% x-coordinate, one for the y-coordinate. -%% @voce{VS = [vx1 vy1 ; vx2 vy2 ; vx3 vy3];} +%% @code{VS = [vx1 vy1 ; vx2 vy2 ; vx3 vy3];} %% %% @seealso{vectorNorm, vectorAngle, isPerpendicular, isParallel, %% normalizeVector, transformVector, rotateVector} Modified: trunk/octave-forge/main/geometry/inst/data2geo.m =================================================================== --- trunk/octave-forge/main/geometry/inst/data2geo.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/inst/data2geo.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -15,8 +15,11 @@ %% -*- texinfo -*- %% @deftypefn {Function File} {@var{fileStr} =} data2geo (@var{data}, @var{lc},@var{opt}) -%% Takes data assuming certain order and builds a .geo file compatible with gmsh. +%% Builds a file compatible with gmsh form data. %% +%% @var{data} is assumed to describe a polygon in @code{polygon2d} format. +%% +%% @seealso{polygon2d} %% @end deftypefn function strFile = data2geo(data,lc,varargin) Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateRotation.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateRotation.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateRotation.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -1,45 +0,0 @@ -function test_suite = testCreateRotation -%TESTCREATEROTATION One-line description here, please. -% output = testCreateRotation(input) -% -% Example -% testCreateRotation -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - -function testCreateCentered - -trans = createRotation(0); -assertElementsAlmostEqual(trans, [1 0 0;0 1 0;0 0 1]); - -trans = createRotation(pi/2); -assertElementsAlmostEqual(trans, [0 -1 0; 1 0 0; 0 0 1]); - -trans = createRotation(pi); -assertElementsAlmostEqual(trans, [-1 0 0;0 -1 0;0 0 1]); - -trans = createRotation(3*pi/2); -assertElementsAlmostEqual(trans, [0 1 0; -1 0 0; 0 0 1]); - -function testCreateShifted - -p0 = [3 5]; -theta = pi/3; - -trans1 = createRotation(p0, theta); -t1 = createTranslation(-p0); -rot = createRotation(theta); -t2 = createTranslation(p0); -trans2 = t2*rot*t1; - -assertElementsAlmostEqual(trans1, trans2); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateScaling.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateScaling.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateScaling.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -1,46 +0,0 @@ -function test_suite = testCreateScaling(varargin) -%TESTCREATESCALING One-line description here, please. -% output = testCreateScaling(input) -% -% Example -% testCreateScaling -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - -function testCentered - -% same coeff for both x and y -trans = createScaling(2); -assertElementsAlmostEqual(trans, [2 0 0;0 2 0;0 0 1]); - -% different factor -trans = createScaling(2, 3); -assertElementsAlmostEqual(trans, [2 0 0;0 3 0;0 0 1]); - -% different factor -trans = createScaling([2 3]); -assertElementsAlmostEqual(trans, [2 0 0;0 3 0;0 0 1]); - -function testShifted - -sx = 2; -sy = 3; -p0 = [4 5]; - -trans1 = createScaling(p0, sx, sy); -t1 = createTranslation(-p0); -sca = createScaling(sx, sy); -t2 = createTranslation(p0); -trans2 = t2*sca*t1; - -assertElementsAlmostEqual(trans1, trans2); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateTranslation.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateTranslation.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCreateTranslation.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -1,23 +0,0 @@ -function test_suite = testCreateTranslation(varargin) -%TESTCREATETRANSLATION One-line description here, please. -% output = testCreateTranslation(input) -% -% Example -% testCreateTranslation -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - -function testBasic - -trans = createTranslation(2, 3); -assertElementsAlmostEqual(trans, [1 0 2;0 1 3;0 0 1]); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createBasisTransform.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createBasisTransform.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createBasisTransform.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -1,99 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function transfo = createBasisTransform(source, target) -%CREATEBASISTRANSFORM Compute matrix for transforming a basis into another basis -% -% TRANSFO = createBasisTransform(SOURCE, TARGET) -% Both SOURCE and TARGET represent basis, in the following form: -% [x0 y0 ex1 ey1 ex2 ey2] -% [y0 y0] is the origin of the basis, [ex1 ey1] is the first direction -% vector, and [ex2 ey2] is the second direction vector. -% -% The result TRANSFO is a 3-by-3 matrix such that a point expressed with -% coordinates of the first basis will be represented by new coordinates -% P2 = transformPoint(P1, TRANSFO) in the target basis. -% -% TRANSFO = createBasisTransform(TARGET) -% Assumes the source is the standard (Oij) basis, with origin at (0,0), -% first direction vector equal to (1,0) and second direction vector -% equal to (0,1). -% -% -% Example -% % standard basis transform -% src = [0 0 1 0 0 1]; -% % target transform, just a rotation by atan(2/3) followed by a scaling -% tgt = [0 0 .75 .5 -.5 .75]; -% % compute transform -% trans = createBasisTransform(src, tgt); -% % transform the point (.25,1.25) into the point (1,1) -% p1 = [.25 1.25]; -% p2 = transformPoint(p1, trans) -% ans = -% 1 1 -% -% See also -% transforms2d -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2010-12-03, using Matlab 7.9.0.529 (R2009b) -% Copyright 2010 INRA - Cepia Software Platform. - -% init basis transform to identity -t1 = eye(3); -t2 = eye(3); - -if nargin==2 - % from source to reference basis - t1(1:2, 1) = source(3:4); - t1(1:2, 2) = source(5:6); - t1(1:2, 3) = source(1:2); -else - % if only one input, use first input as target basis, and leave the - % first matrix to identity - target = source; -end - -% from reference to target basis -t2(1:2, 1) = target(3:4); -t2(1:2, 2) = target(5:6); -t2(1:2, 3) = target(1:2); - -% compute transfo -% same as: transfo = inv(t2)*t1; -transfo = t2\t1; - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createHomothecy.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createHomothecy.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createHomothecy.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -1,66 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function trans = createHomothecy(point, ratio) -%CREATEHOMOTHECY Create the the 3x3 matrix of an homothetic transform -% -% TRANS = createHomothecy(POINT, K); -% POINT is the center of the homothecy, K is its factor. -% -% See also: -% transforms2d, transformPoint, createTranslation -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 20/01/2005. -% - -% HISTORY -% 22/04/2009: rename as createHomothecy - -% extract coordinate of center -x0 = point(:,1); -y0 = point(:,2); - -% compute coefficients of the matrix -m00 = ratio; -m01 = 0; -m02 = x0*(1-ratio); -m10 = 0; -m11 = ratio; -m12 = y0*(1-ratio); - -% create transformation -trans = [m00 m01 m02; m10 m11 m12; 0 0 1]; Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLineReflection.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLineReflection.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createLineReflection.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -1,74 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function trans = createLineReflection(line) -%CREATELINEREFLECTION Create the the 3x3 matrix of a line reflection -% -% TRANS = createLineReflection(LINE); -% where line is given as [x0 y0 dx dy], return the affine tansform -% corresponding to the desired line reflection -% -% -% See also: -% lines2d, transforms2d, transformPoint, -% createTranslation, createHomothecy, createScaling -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 19/01/2005. -% - -% HISTORY -% 22/04/2009: rename as createLineReflection - -% extract line parameters -x0 = line(:,1); -y0 = line(:,2); -dx = line(:,3); -dy = line(:,4); - -% normalisation coefficient of line direction vector -delta = dx*dx + dy*dy; - -% compute coefficients of transform -m00 = (dx*dx - dy*dy)/delta; -m01 = 2*dx*dy/delta; -m02 = 2*dy*(dy*x0 - dx*y0)/delta; -m10 = 2*dx*dy/delta; -m11 = (dy*dy - dx*dx)/delta; -m12 = 2*dx*(dx*y0 - dy*x0)/delta; - -% create transformation -trans = [m00 m01 m02; m10 m11 m12; 0 0 1]; Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRotation.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRotation.m 2011-10-09 03:12:31 UTC (rev 8716) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/createRotation.m 2011-10-09 16:20:45 UTC (rev 8717) @@ -1,92 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ... [truncated message content] |
From: <jpi...@us...> - 2011-10-09 17:01:57
|
Revision: 8718 http://octave.svn.sourceforge.net/octave/?rev=8718&view=rev Author: jpicarbajal Date: 2011-10-09 17:01:50 +0000 (Sun, 09 Oct 2011) Log Message: ----------- geometry. Transforms finshed Modified Paths: -------------- trunk/octave-forge/main/geometry/doc/NEWS Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/inst/fitAffineTransform2d.m trunk/octave-forge/main/geometry/geom2d/inst/transformEdge.m trunk/octave-forge/main/geometry/geom2d/inst/transformLine.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/fitAffineTransform2d.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformEdge.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformLine.m Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-10-09 16:20:45 UTC (rev 8717) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-10-09 17:01:50 UTC (rev 8718) @@ -70,3 +70,17 @@ vectors2d.m =============================================================================== +geometry-1.1.3 Release Date: 2011-10-10 Release Manager: Juan Pablo Carbajal +=============================================================================== + +* Continue to add geom2d from matGeom (transforms) + createBasisTransform.m + createHomothecy.m + createLineReflection.m + createRotation.m + createScaling.m + createTranslation.m + transformPoint.m + transforms2d.m + +=============================================================================== Copied: trunk/octave-forge/main/geometry/geom2d/inst/fitAffineTransform2d.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/fitAffineTransform2d.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/fitAffineTransform2d.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/fitAffineTransform2d.m 2011-10-09 17:01:50 UTC (rev 8718) @@ -0,0 +1,73 @@ +%% Copyright (c) 2011, INRA +%% 2009-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{T} = } fitAffineTransform2d (@var{pts1}, @var{pts2}) +%% Fit an affine transform using two point sets. +%% +%% Example +%% +%% @example +%% N = 10; +%% pts = rand(N, 2)*10; +%% trans = createRotation(3, 4, pi/4); +%% pts2 = transformPoint(pts, trans); +%% pts3 = pts2 + randn(N, 2)*2; +%% fitted = fitAffineTransform2d(pts, pts2) +%%@end example +%% +%% @seealso{transforms2d} +%% @end deftypefn + +function trans = fitAffineTransform2d(pts1, pts2) + + % number of points + N = size(pts1, 1); + + % main matrix of the problem + A = [... + pts1(:,1) pts1(:,2) ones(N,1) zeros(N, 3) ; ... + zeros(N, 3) pts1(:,1) pts1(:,2) ones(N,1) ]; + + % conditions initialisations + B = [pts2(:,1) ; pts2(:,2)]; + + % compute coefficients using least square + coefs = A\B; + + % format to a matrix + trans = [coefs(1:3)' ; coefs(4:6)'; 0 0 1]; + +endfunction + + Copied: trunk/octave-forge/main/geometry/geom2d/inst/transformEdge.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformEdge.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/transformEdge.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/transformEdge.m 2011-10-09 17:01:50 UTC (rev 8718) @@ -0,0 +1,71 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{edge2} = } transformEdge (@var{edge1}, @var{T}) +%% Transform an edge with an affine transform. +%% +%% Where @var{edge1} has the form [x1 y1 x2 y1], and @var{T} is a transformation +%% matrix, return the edge transformed with affine transform @var{T}. +%% +%% Format of TRANS can be one of : +%% [a b] , [a b c] , or [a b c] +%% [d e] [d e f] [d e f] +%% [0 0 1] +%% +%% Also works when @var{edge1} is a [Nx4] array of double. In this case, @var{edge2} +%% has the same size as @var{edge1}. +%% +%% @seealso{edges2d, transforms2d, transformPoint, translation, rotation} +%% @end deftypefn + +function dest = transformEdge(edge, trans) + + dest = zeros(size(edge)); + + % compute position + dest(:,1) = edge(:,1)*trans(1,1) + edge(:,2)*trans(1,2); + dest(:,2) = edge(:,1)*trans(2,1) + edge(:,2)*trans(2,2); + dest(:,3) = edge(:,3)*trans(1,1) + edge(:,3)*trans(1,2); + dest(:,4) = edge(:,4)*trans(2,1) + edge(:,4)*trans(2,2); + + % add translation vector, if exist + if size(trans, 2)>2 + dest(:,1) = dest(:,1)+trans(1,3); + dest(:,2) = dest(:,2)+trans(2,3); + dest(:,3) = dest(:,3)+trans(1,3); + dest(:,4) = dest(:,4)+trans(2,3); + end + +endfunction + Copied: trunk/octave-forge/main/geometry/geom2d/inst/transformLine.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformLine.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/transformLine.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/transformLine.m 2011-10-09 17:01:50 UTC (rev 8718) @@ -0,0 +1,66 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{line2} = } transformLine (@var{line1}, @var{T}) +%% Transform a line with an affine transform. +%% +%% Returns the line @var{line1} transformed with affine transform @var{T}. +%% @var{line1} has the form [x0 y0 dx dy], and @var{T} is a transformation +%% matrix. +%% +%% Format of @var{T} can be one of : +%% [a b] , [a b c] , or [a b c] +%% [d e] [d e f] [d e f] +%% [0 0 1] +%% +%% Also works when @var{line1} is a [Nx4] array of double. In this case, @var{line2} +%% has the same size as @var{line1}. +%% +%% @seealso{lines2d, transforms2d, transformPoint} +%% @end deftypefn + +function dest = transformLine(line, trans) + + % isolate points + points1 = line(:, 1:2); + points2 = line(:, 1:2) + line(:, 3:4); + + % transform points + points1 = transformPoint(points1, trans); + points2 = transformPoint(points2, trans); + + dest = createLine(points1, points2); + +endfunction + Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/fitAffineTransform2d.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/fitAffineTransform2d.m 2011-10-09 16:20:45 UTC (rev 8717) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/fitAffineTransform2d.m 2011-10-09 17:01:50 UTC (rev 8718) @@ -1,73 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function trans = fitAffineTransform2d(pts1, pts2) -%FITAFFINETRANSFORM2D Fit an affine transform using two point sets -% TRANS = fitAffineTransform2d(PTS1, PTS2) -% -% Example -% N = 10; -% pts = rand(N, 2)*10; -% trans = createRotation(3, 4, pi/4); -% pts2 = transformPoint(pts, trans); -% pts3 = pts2 + randn(N, 2)*2; -% fitted = fitAffineTransform2d(pts, pts2); -% -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-07-31, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. - - -% number of points -N = size(pts1, 1); - -% main matrix of the problem -A = [... - pts1(:,1) pts1(:,2) ones(N,1) zeros(N, 3) ; ... - zeros(N, 3) pts1(:,1) pts1(:,2) ones(N,1) ]; - -% conditions initialisations -B = [pts2(:,1) ; pts2(:,2)]; - -% compute coefficients using least square -coefs = A\B; - -% format to a matrix -trans = [coefs(1:3)' ; coefs(4:6)'; 0 0 1]; Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformEdge.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformEdge.m 2011-10-09 16:20:45 UTC (rev 8717) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformEdge.m 2011-10-09 17:01:50 UTC (rev 8718) @@ -1,75 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function dest = transformEdge(edge, trans) -%TRANSFORMEDGE Transform an edge with an affine transform -% -% EDGE2 = transformEdge(EDGE1, TRANS); -% where EDGE1 has the form [x1 y1 x2 y1], and TRANS is a transformation -% matrix, return the edge transformed with affine transform TRANS. -% -% Format of TRANS can be one of : -% [a b] , [a b c] , or [a b c] -% [d e] [d e f] [d e f] -% [0 0 1] -% -% EDGE2 = transformEdge(EDGES, TRANS); -% Also wotk when EDGES is a [N*4] array of double. In this case, EDGE2 -% has the same size as EDGE. -% -% See also: -% edges2d, transforms2d, transformPoint, translation, rotation -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 06/04/2004. -% - -% allocate memory -dest = zeros(size(edge)); - -% compute position -dest(:,1) = edge(:,1)*trans(1,1) + edge(:,2)*trans(1,2); -dest(:,2) = edge(:,1)*trans(2,1) + edge(:,2)*trans(2,2); -dest(:,3) = edge(:,3)*trans(1,1) + edge(:,3)*trans(1,2); -dest(:,4) = edge(:,4)*trans(2,1) + edge(:,4)*trans(2,2); - -% add translation vector, if exist -if size(trans, 2)>2 - dest(:,1) = dest(:,1)+trans(1,3); - dest(:,2) = dest(:,2)+trans(2,3); - dest(:,3) = dest(:,3)+trans(1,3); - dest(:,4) = dest(:,4)+trans(2,3); -end Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformLine.m 2011-10-09 16:20:45 UTC (rev 8717) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/transformLine.m 2011-10-09 17:01:50 UTC (rev 8718) @@ -1,73 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function dest = transformLine(line, trans) -%TRANSFORMLINE Transform a line with an affine transform -% -% LINE2 = transformLine(LINE1, TRANS); -% returns the line LINE1 transformed with affine transform TRANS. -% LINE1 has the form [x0 y0 dx dy], and TRANS is a transformation -% matrix. -% -% Format of TRANS can be one of : -% [a b] , [a b c] , or [a b c] -% [d e] [d e f] [d e f] -% [0 0 1] -% -% LINE2 = transformLine(LINES, TRANS); -% Also work when LINES is a [N*4] array of double. In this case, LINE2 -% has the same size as LINE. -% -% See also: -% lines2d, transforms2d, transformPoint -% -% --------- -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 06/04/2004. -% - -% HISTORY -% 02/03/2007: rewrite function - - -% isolate points -points1 = line(:, 1:2); -points2 = line(:, 1:2) + line(:, 3:4); - -% transform points -points1 = transformPoint(points1, trans); -points2 = transformPoint(points2, trans); - -dest = createLine(points1, points2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-09 18:09:15
|
Revision: 8719 http://octave.svn.sourceforge.net/octave/?rev=8719&view=rev Author: jpicarbajal Date: 2011-10-09 18:09:08 +0000 (Sun, 09 Oct 2011) Log Message: ----------- geometry. Adding points2d Modified Paths: -------------- trunk/octave-forge/main/geometry/doc/NEWS trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/inst/centroid.m trunk/octave-forge/main/geometry/geom2d/inst/distancePoints.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCentroid.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testDistancePoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePoints.m Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-10-09 17:01:50 UTC (rev 8718) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-10-09 18:09:08 UTC (rev 8719) @@ -82,5 +82,8 @@ createTranslation.m transformPoint.m transforms2d.m + fitAffineTransform2d.m + transformEdge.m + transformLine.m =============================================================================== Copied: trunk/octave-forge/main/geometry/geom2d/inst/centroid.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/centroid.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/centroid.m 2011-10-09 18:09:08 UTC (rev 8719) @@ -0,0 +1,129 @@ +%% Copyright (c) 2011, INRA +%% 2003-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{c} = } centroid (@var{points}) +%% @deftypefnx {Function File} {@var{c} = } centroid (@var{px}, @var{py}) +%% @deftypefnx {Function File} {@var{c} = } centroid (@dots{}, @var{mass}) +%% Compute centroid (center of mass) of a set of points. +%% +%% Computes the ND-dimensional centroid of a set of points. +%% @{points} is an array with as many rows as the number of points, and as +%% many columns as the number of dimensions. +%% @{px} and @{py} are two column vectors containing coordinates of the +%% 2-dimensional points. +%% The result @var{c} is a row vector with ND columns. +%% +%% If @var{mass} is given, computes center of mass of @var{points}, weighted by coefficient @var{mass}. +%% @var{points} is a Np-by-Nd array, @var{mass} is Np-by-1 array, and @var{px} and @var{py} are +%% also both Np-by-1 arrays. +%% +%% Example: +%% +%% @example +%% pts = [2 2;6 1;6 5;2 4]; +%% centroid(pts) +%% ans = +%% 4 3 +%%@end example +%% +%% @seealso{points2d, polygonCentroid} +%% @end deftypefn + +function center = centroid(varargin) + + %% extract input arguments + + % use empty mass by default + mass = []; + + if nargin==1 + % give only array of points + pts = varargin{1}; + + elseif nargin==2 + % either POINTS+MASS or PX+PY + var = varargin{1}; + if size(var, 2)>1 + % arguments are POINTS, and MASS + pts = var; + mass = varargin{2}; + else + % arguments are PX and PY + pts = [var varargin{2}]; + end + + elseif nargin==3 + % arguments are PX, PY, and MASS + pts = [varargin{1} varargin{2}]; + mass = varargin{3}; + end + + %% compute centroid + + if isempty(mass) + % no weight + center = mean(pts); + + else + % format mass to have sum equal to 1, and column format + mass = mass(:)/sum(mass(:)); + + % compute weighted centroid + center = sum(bsxfun(@times, pts, mass), 1); + % equivalent to: + % center = sum(pts .* mass(:, ones(1, size(pts, 2)))); + end + +endfunction + +%!test +%! points = [0 0;10 0;10 10;0 10]; +%! centro = centroid(points); +%! assert ([5 5], centro, 1e-6); + +%!test +%! points = [0 0;10 0;10 10;0 10]; +%! centro = centroid(points(:,1), points(:,2)); +%! assert ([5 5], centro, 1e-6); + +%!test +%! points = [0 0;30 0;30 30;0 30]; +%! centro = centroid(points, [1;1;1;3]); +%! assert ([10 20], centro, 1e-6); + +%!test +%! points = [0 0;30 0;30 30;0 30]; +%! centro = centroid(points(:,1), points(:,2), [1;1;1;3]); +%! assert ([10 20], centro, 1e-6); + Copied: trunk/octave-forge/main/geometry/geom2d/inst/distancePoints.m (from rev 8716, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePoints.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/distancePoints.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/distancePoints.m 2011-10-09 18:09:08 UTC (rev 8719) @@ -0,0 +1,204 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{d} = } distancePoints (@var{p1}, @var{p2}) +%% @deftypefnx {Function File} {@var{d} = } distancePoints (@var{p1}, @var{p2}, @var{norm}) +%% @deftypefnx {Function File} {@var{d} = } distancePoints (@dots{}, 'diag') +%% Compute distance between two points. +%% +%% Returns the Euclidean distance between points @var{p1} and @var{p2}. +%% If @var{p1} and @var{p2} are two arrays of points, result is a N1xN2 array +%% containing distance between each point of @var{p1} and each point of @var{p2}. +%% +%% Is @var{norm} is given, computes distance using the specified norm. @var{norm}=2 corresponds to usual +%% euclidean distance, @var{norm}=1 corresponds to Manhattan distance, @var{norm}=inf +%% is assumed to correspond to maximum difference in coordinate. Other +%% values (>0) can be specified. +%% +%% When 'diag' is given, computes only distances between @var{p1}(i,:) and @var{p2}(i,:). +%% +%% @seealso{points2d, minDistancePoints} +%% @end deftypefn + +function dist = distancePoints(p1, p2, varargin) + + %% Setup options + + % default values + diag = false; + norm = 2; + + % check first argument: norm or diag + if ~isempty(varargin) + var = varargin{1}; + if isnumeric(var) + norm = var; + elseif strncmp('diag', var, 4) + diag = true; + end + varargin(1) = []; + end + + % check last argument: diag + if ~isempty(varargin) + var = varargin{1}; + if strncmp('diag', var, 4) + diag = true; + end + end + + + % number of points in each array and their dimension + n1 = size(p1, 1); + n2 = size(p2, 1); + d = size(p1, 2); + + if diag + % compute distance only for apparied couples of pixels + dist = zeros(n1, 1); + if norm==2 + % Compute euclidian distance. this is the default case + % Compute difference of coordinate for each pair of point + % and for each dimension. -> dist is a [n1*n2] array. + for i=1:d + dist = dist + (p2(:,i)-p1(:,i)).^2; + end + dist = sqrt(dist); + elseif norm==inf + % infinite norm corresponds to maximal difference of coordinate + for i=1:d + dist = max(dist, abs(p2(:,i)-p1(:,i))); + end + else + % compute distance using the specified norm. + for i=1:d + dist = dist + power((abs(p2(:,i)-p1(:,i))), norm); + end + dist = power(dist, 1/norm); + end + else + % compute distance for all couples of pixels + dist = zeros(n1, n2); + if norm==2 + % Compute euclidian distance. this is the default case + % Compute difference of coordinate for each pair of point + % and for each dimension. -> dist is a [n1*n2] array. + for i=1:d + % equivalent to: + % dist = dist + ... + % (repmat(p1(:,i), [1 n2])-repmat(p2(:,i)', [n1 1])).^2; + dist = dist + (p1(:, i*ones(1, n2))-p2(:, i*ones(n1, 1))').^2; + end + dist = sqrt(dist); + elseif norm==inf + % infinite norm corresponds to maximal difference of coordinate + for i=1:d + dist = max(dist, abs(p1(:, i*ones(1, n2))-p2(:, i*ones(n1, 1))')); + end + else + % compute distance using the specified norm. + for i=1:d + % equivalent to: + % dist = dist + power((abs(repmat(p1(:,i), [1 n2]) - ... + % repmat(p2(:,i)', [n1 1]))), norm); + dist = dist + power((abs(p1(:, i*ones(1, n2))-p2(:, i*ones(n1, 1))')), norm); + end + dist = power(dist, 1/norm); + end + end + +endfunction + +%!shared pt1,pt2,pt3,pt4 +%! pt1 = [10 10]; +%! pt2 = [10 20]; +%! pt3 = [20 20]; +%! pt4 = [20 10]; + +%!assert (distancePoints(pt1, pt2), 10, 1e-6); +%!assert (distancePoints(pt2, pt3), 10, 1e-6); +%!assert (distancePoints(pt1, pt3), 10*sqrt(2), 1e-6); +%!assert (distancePoints(pt1, pt2, 1), 10, 1e-6); +%!assert (distancePoints(pt2, pt3, 1), 10, 1e-6); +%!assert (distancePoints(pt1, pt3, 1), 20, 1e-6); +%!assert (distancePoints(pt1, pt2, inf), 10, 1e-6); +%!assert (distancePoints(pt2, pt3, inf), 10, 1e-6); +%!assert (distancePoints(pt1, pt3, inf), 10, 1e-6); +%!assert (distancePoints(pt1, [pt1; pt2; pt3]), [0 10 10*sqrt(2)], 1e-6); + +%!test +%! array1 = [pt1;pt2;pt3]; +%! array2 = [pt1;pt2;pt3;pt4]; +%! res = [0 10 10*sqrt(2) 10; 10 0 10 10*sqrt(2); 10*sqrt(2) 10 0 10]; +%! assert (distancePoints(array1, array2), res, 1e-6); +%! assert (distancePoints(array2, array2, 'diag'), [0;0;0;0], 1e-6); + +%!test +%! array1 = [pt1;pt2;pt3]; +%! array2 = [pt2;pt3;pt1]; +%! assert (distancePoints(array1, array2, inf, 'diag'), [10;10;10], 1e-6); + +%!shared pt1,pt2,pt3,pt4 +%! pt1 = [10 10 10]; +%! pt2 = [10 20 10]; +%! pt3 = [20 20 10]; +%! pt4 = [20 20 20]; + +%!assert (distancePoints(pt1, pt2), 10, 1e-6); +%!assert (distancePoints(pt2, pt3), 10, 1e-6); +%!assert (distancePoints(pt1, pt3), 10*sqrt(2), 1e-6); +%!assert (distancePoints(pt1, pt4), 10*sqrt(3), 1e-6); +%!assert (distancePoints(pt1, pt2, inf), 10, 1e-6); +%!assert (distancePoints(pt2, pt3, inf), 10, 1e-6); +%!assert (distancePoints(pt1, pt3, inf), 10, 1e-6); +%!assert (distancePoints(pt1, pt4, inf), 10, 1e-6); + + +%!shared pt1,pt2,pt3,pt4 +%! pt1 = [10 10 30]; +%! pt2 = [10 20 30]; +%! pt3 = [20 20 30]; +%! pt4 = [20 20 40]; + +%!assert (distancePoints(pt1, pt2, 1), 10, 1e-6); +%!assert (distancePoints(pt2, pt3, 1), 10, 1e-6); +%!assert (distancePoints(pt1, pt3, 1), 20, 1e-6); +%!assert (distancePoints(pt1, pt4, 1), 30, 1e-6); + +%!test +%! array1 = [pt1;pt2;pt3]; +%! array2 = [pt2;pt3;pt1]; +%! assert (distancePoints(array1, array2, 'diag'), [10;10;10*sqrt(2)], 1e-6); +%! assert (distancePoints(array1, array2, 1, 'diag'), [10;10;20], 1e-6); + Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCentroid.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCentroid.m 2011-10-09 17:01:50 UTC (rev 8718) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testCentroid.m 2011-10-09 18:09:08 UTC (rev 8719) @@ -1,47 +0,0 @@ -function test_suite = testCentroid(varargin) -%TESTCLIPLINE One-line description here, please. -% output = testCentroid(input) -% -% Example -% testCentroid -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. - -initTestSuite; - -function testSquareCentroid -% Centroid of 4 points - -points = [0 0;10 0;10 10;0 10]; -centro = centroid(points); -assertElementsAlmostEqual([5 5], centro); - -function testSquareCentroidSeparateCoords -% Centroid of 4 points - -points = [0 0;10 0;10 10;0 10]; -centro = centroid(points(:,1), points(:,2)); -assertElementsAlmostEqual([5 5], centro); - -function testSquareWeightedCentroid -% Centroid of 4 points - -points = [0 0;30 0;30 30;0 30]; -centro = centroid(points, [1;1;1;3]); -assertElementsAlmostEqual([10 20], centro); - - -function testSquareWeightedCentroidSeparateCoords -% Centroid of 4 points - -points = [0 0;30 0;30 30;0 30]; -centro = centroid(points(:,1), points(:,2), [1;1;1;3]); -assertElementsAlmostEqual([10 20], centro); - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testDistancePoints.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testDistancePoints.m 2011-10-09 17:01:50 UTC (rev 8718) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testDistancePoints.m 2011-10-09 18:09:08 UTC (rev 8719) @@ -1,165 +0,0 @@ -function test_suite = testDistancePoints(varargin) %#ok<STOUT> -%TESTDISTANCEPOINTS One-line description here, please. -% output = testDistancePoints(input) -% -% Example -% testDistancePoints -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - -function testSingleSingle %#ok<*DEFNU> - -pt1 = [10 10]; -pt2 = [10 20]; -pt3 = [20 20]; - -assertElementsAlmostEqual(distancePoints(pt1, pt2), 10); -assertElementsAlmostEqual(distancePoints(pt2, pt3), 10); -assertElementsAlmostEqual(distancePoints(pt1, pt3), 10*sqrt(2)); - -function testSingleSingleNorm1 -% test norm 1, equivalent to sum of absolute differences - -pt1 = [10 10]; -pt2 = [10 20]; -pt3 = [20 20]; - -assertElementsAlmostEqual(distancePoints(pt1, pt2, 1), 10); -assertElementsAlmostEqual(distancePoints(pt2, pt3, 1), 10); -assertElementsAlmostEqual(distancePoints(pt1, pt3, 1), 20); - -function testSingleSingleMaxNorm - -pt1 = [10 10]; -pt2 = [10 20]; -pt3 = [20 20]; - -assertElementsAlmostEqual(distancePoints(pt1, pt2, inf), 10); -assertElementsAlmostEqual(distancePoints(pt2, pt3, inf), 10); -assertElementsAlmostEqual(distancePoints(pt1, pt3, inf), 10); - -function testSingleSingle3d - -pt1 = [10 10 10]; -pt2 = [10 20 10]; -pt3 = [20 20 10]; -pt4 = [20 20 20]; - -assertElementsAlmostEqual(distancePoints(pt1, pt2), 10); -assertElementsAlmostEqual(distancePoints(pt2, pt3), 10); -assertElementsAlmostEqual(distancePoints(pt1, pt3), 10*sqrt(2)); -assertElementsAlmostEqual(distancePoints(pt1, pt4), 10*sqrt(3)); - - -function testSingleSingle3dNorm1 -% test norm 1, equivalent to sum of absolute differences - -pt1 = [10 10 30]; -pt2 = [10 20 30]; -pt3 = [20 20 30]; -pt4 = [20 20 40]; - -assertElementsAlmostEqual(distancePoints(pt1, pt2, 1), 10); -assertElementsAlmostEqual(distancePoints(pt2, pt3, 1), 10); -assertElementsAlmostEqual(distancePoints(pt1, pt3, 1), 20); -assertElementsAlmostEqual(distancePoints(pt1, pt4, 1), 30); - -function testSingleSingleMaxNorm3d - -pt1 = [10 10 10]; -pt2 = [10 20 10]; -pt3 = [20 20 10]; -pt4 = [20 20 20]; - -assertElementsAlmostEqual(distancePoints(pt1, pt2, inf), 10); -assertElementsAlmostEqual(distancePoints(pt2, pt3, inf), 10); -assertElementsAlmostEqual(distancePoints(pt1, pt3, inf), 10); -assertElementsAlmostEqual(distancePoints(pt1, pt4, inf), 10); - -function testSingleArray - -pt1 = [10 10]; -pt2 = [10 20]; -pt3 = [20 20]; - -assertElementsAlmostEqual(... - distancePoints(pt1, [pt1; pt2; pt3]), ... - [0 10 10*sqrt(2)]); - -function testArrayArray - -pt1 = [10 10]; -pt2 = [10 20]; -pt3 = [20 20]; -pt4 = [20 10]; - -array1 = [pt1;pt2;pt3]; -array2 = [pt1;pt2;pt3;pt4]; -res = [... - 0 10 10*sqrt(2) 10;... - 10 0 10 10*sqrt(2);... - 10*sqrt(2) 10 0 10]; - -assertElementsAlmostEqual(distancePoints(array1, array2), res); - -function testArrayArrayDiag - -pt1 = [10 10]; -pt2 = [10 20]; -pt3 = [20 20]; - -array = [pt1;pt2;pt3]; - -assertElementsAlmostEqual(... - distancePoints(array, array, 'diag'), ... - [0;0;0]); - -function testArrayArray3dDiag - -pt1 = [10 10 30]; -pt2 = [10 20 30]; -pt3 = [10 20 40]; - -array1 = [pt1;pt2;pt3]; -array2 = [pt2;pt3;pt1]; - -assertElementsAlmostEqual(... - distancePoints(array1, array2, 'diag'), ... - [10;10;10*sqrt(2)]); - -function testArrayArray3dNorm1Diag - -pt1 = [10 10 30]; -pt2 = [10 20 30]; -pt3 = [10 20 40]; - -array1 = [pt1;pt2;pt3]; -array2 = [pt2;pt3;pt1]; - -assertElementsAlmostEqual(... - distancePoints(array1, array2, 1, 'diag'), ... - [10;10;20]); - - -function testArrayArrayDiagMaxNorm - -pt1 = [10 10]; -pt2 = [10 20]; -pt3 = [20 20]; - -array1 = [pt1;pt2;pt3]; -array2 = [pt2;pt3;pt1]; - -assertElementsAlmostEqual(... - distancePoints(array1, array2, inf, 'diag'), ... - [10;10;10]); Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m 2011-10-09 17:01:50 UTC (rev 8718) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/centroid.m 2011-10-09 18:09:08 UTC (rev 8719) @@ -1,116 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function center = centroid(varargin) -%CENTROID Compute centroid (center of mass) of a set of points -% -% PTS = centroid(POINTS) -% PTS = centroid(PTX, PTY) -% Computes the ND-dimensional centroid of a set of points. -% POINTS is an array with as many rows as the number of points, and as -% many columns as the number of dimensions. -% PTX and PTY are two column vectors containing coordinates of the -% 2-dimensional points. -% The result PTS is a row vector with Nd columns. -% -% PTS = centroid(POINTS, MASS) -% PTS = centroid(PTX, PTY, MASS) -% Computes center of mass of POINTS, weighted by coefficient MASS. -% POINTS is a Np-by-Nd array, MASS is Np-by-1 array, and PTX and PTY are -% also both Np-by-1 arrays. -% -% Example: -% pts = [2 2;6 1;6 5;2 4]; -% centroid(pts) -% ans = -% 4 3 -% -% See Also: -% points2d, polygonCentroid -% -% --------- -% Author: David Legland -% e-mail: dav...@gr... -% created the 07/04/2003. -% Copyright 2010 INRA - Cepia Software Platform. -% - -% HISTORY -% 2009-06-22 support for 3D points -% 2010-04-12 fix bug in weighted centroid -% 2010-12-06 update doc - - -%% extract input arguments - -% use empty mass by default -mass = []; - -if nargin==1 - % give only array of points - pts = varargin{1}; - -elseif nargin==2 - % either POINTS+MASS or PX+PY - var = varargin{1}; - if size(var, 2)>1 - % arguments are POINTS, and MASS - pts = var; - mass = varargin{2}; - else - % arguments are PX and PY - pts = [var varargin{2}]; - end - -elseif nargin==3 - % arguments are PX, PY, and MASS - pts = [varargin{1} varargin{2}]; - mass = varargin{3}; -end - -%% compute centroid - -if isempty(mass) - % no weight - center = mean(pts); - -else - % format mass to have sum equal to 1, and column format - mass = mass(:)/sum(mass(:)); - - % compute weighted centroid - center = sum(bsxfun(@times, pts, mass), 1); - % equivalent to: - % center = sum(pts .* mass(:, ones(1, size(pts, 2)))); -end Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePoints.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePoints.m 2011-10-09 17:01:50 UTC (rev 8718) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/distancePoints.m 2011-10-09 18:09:08 UTC (rev 8719) @@ -1,156 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function dist = distancePoints(p1, p2, varargin) -%DISTANCEPOINTS Compute distance between two points -% -% D = distancePoints(P1, P2) -% Return the Euclidean distance between points P1 and P2. -% -% If P1 and P2 are two arrays of points, result is a N1*N2 array -% containing distance between each point of P1 and each point of P2. -% -% D = distancePoints(P1, P2, NORM) -% Compute distance using the specified norm. NORM=2 corresponds to usual -% euclidean distance, NORM=1 corresponds to Manhattan distance, NORM=inf -% is assumed to correspond to maximum difference in coordinate. Other -% values (>0) can be specified. -% -% D = distancePoints(..., 'diag') -% compute only distances between P1(i,:) and P2(i,:). -% -% See also: -% points2d, minDistancePoints -% -% -% --------- -% -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 24/02/2004. -% - -% HISTORY : -% 25/05/2004: manage 2 array of points -% 07/04/2004: add option for computing only diagonal. -% 30/10/2006: generalize to any dimension, and manage different norms -% 03/01/2007: bug for arbitrary norm, and update doc -% 28/08/2007: fix bug for norms 2 and infinite, in diagonal case - - -%% Setup options - -% default values -diag = false; -norm = 2; - -% check first argument: norm or diag -if ~isempty(varargin) - var = varargin{1}; - if isnumeric(var) - norm = var; - elseif strncmp('diag', var, 4) - diag = true; - end - varargin(1) = []; -end - -% check last argument: diag -if ~isempty(varargin) - var = varargin{1}; - if strncmp('diag', var, 4) - diag = true; - end -end - - -% number of points in each array and their dimension -n1 = size(p1, 1); -n2 = size(p2, 1); -d = size(p1, 2); - -if diag - % compute distance only for apparied couples of pixels - dist = zeros(n1, 1); - if norm==2 - % Compute euclidian distance. this is the default case - % Compute difference of coordinate for each pair of point - % and for each dimension. -> dist is a [n1*n2] array. - for i=1:d - dist = dist + (p2(:,i)-p1(:,i)).^2; - end - dist = sqrt(dist); - elseif norm==inf - % infinite norm corresponds to maximal difference of coordinate - for i=1:d - dist = max(dist, abs(p2(:,i)-p1(:,i))); - end - else - % compute distance using the specified norm. - for i=1:d - dist = dist + power((abs(p2(:,i)-p1(:,i))), norm); - end - dist = power(dist, 1/norm); - end -else - % compute distance for all couples of pixels - dist = zeros(n1, n2); - if norm==2 - % Compute euclidian distance. this is the default case - % Compute difference of coordinate for each pair of point - % and for each dimension. -> dist is a [n1*n2] array. - for i=1:d - % equivalent to: - % dist = dist + ... - % (repmat(p1(:,i), [1 n2])-repmat(p2(:,i)', [n1 1])).^2; - dist = dist + (p1(:, i*ones(1, n2))-p2(:, i*ones(n1, 1))').^2; - end - dist = sqrt(dist); - elseif norm==inf - % infinite norm corresponds to maximal difference of coordinate - for i=1:d - dist = max(dist, abs(p1(:, i*ones(1, n2))-p2(:, i*ones(n1, 1))')); - end - else - % compute distance using the specified norm. - for i=1:d - % equivalent to: - % dist = dist + power((abs(repmat(p1(:,i), [1 n2]) - ... - % repmat(p2(:,i)', [n1 1]))), norm); - dist = dist + power((abs(p1(:, i*ones(1, n2))-p2(:, i*ones(n1, 1))')), norm); - end - dist = power(dist, 1/norm); - end -end - Modified: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m 2011-10-09 17:01:50 UTC (rev 8718) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m 2011-10-09 18:09:08 UTC (rev 8719) @@ -31,7 +31,6 @@ %% those of the authors and should not be interpreted as representing official %% policies, either expressed or implied, of copyright holder. - function varargout = drawPoint(varargin) %DRAWPOINT Draw the point on the axis. % This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-13 17:08:02
|
Revision: 8738 http://octave.svn.sourceforge.net/octave/?rev=8738&view=rev Author: jpicarbajal Date: 2011-10-13 17:07:54 +0000 (Thu, 13 Oct 2011) Log Message: ----------- geometry. Finish with points2d Modified Paths: -------------- trunk/octave-forge/main/geometry/doc/NEWS Added Paths: ----------- trunk/octave-forge/main/geometry/geom2d/inst/drawPoint.m trunk/octave-forge/main/geometry/geom2d/inst/isCounterClockwise.m trunk/octave-forge/main/geometry/geom2d/inst/minDistancePoints.m trunk/octave-forge/main/geometry/geom2d/inst/pointOnLine.m trunk/octave-forge/main/geometry/geom2d/inst/points2d.m Removed Paths: ------------- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIsCounterClockwise.m trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testMinDistancePoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isCounterClockwise.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/minDistancePoints.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/pointOnLine.m trunk/octave-forge/main/geometry/matGeom_raw/geom2d/points2d.m Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-10-13 07:43:26 UTC (rev 8737) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-10-13 17:07:54 UTC (rev 8738) @@ -87,5 +87,7 @@ transformLine.m centroid.m distancePoints.m + midPoint.m + polarPoint.m =============================================================================== Copied: trunk/octave-forge/main/geometry/geom2d/inst/drawPoint.m (from rev 8731, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/drawPoint.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/drawPoint.m 2011-10-13 17:07:54 UTC (rev 8738) @@ -0,0 +1,91 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{h} = } drawPoint (@var{x}, @var{y}) +%% @deftypefnx {Function File} {@var{h} = } drawPoint (@var{coord}) +%% @deftypefnx {Function File} {@var{h} = } drawPoint (@dots{}, @var{opt}) +%% Draw the point on the axis. +% +% Draws points defined by coordinates @var{x} and @var{y}Y. +% @var{x} and @var{y} should be array the same size. Coordinates can be +% packed coordinates in a single [N*2] array @var{coord}. Options @var{opt} +% are passed to the @code{plot} function. +% +% @seealso{points2d, clipPoints} +% +%% @end deftypefn + +function varargout = drawPoint(varargin) + + % process input arguments + var = varargin{1}; + if size(var, 2)==1 + % points stored in separate arrays + px = varargin{1}; + py = varargin{2}; + varargin(1:2) = []; + else + % points packed in one array + px = var(:, 1); + py = var(:, 2); + varargin(1) = []; + end + + % ensure we have column vectors + px = px(:); + py = py(:); + + % default drawing options, but keep specified options if it has the form of + % a bundled string + if length(varargin)~=1 + varargin = [{'linestyle', 'none', 'marker', 'o', 'color', 'b'}, varargin]; + end + + % plot the points, using specified drawing options + h = plot(px(:), py(:), varargin{:}); + + % process output arguments + if nargout>0 + varargout{1}=h; + end + +endfunction + +%!demo +%! drawPoint(10, 10); + +%!demo +%! t = linspace(0, 2*pi, 20)'; +%! drawPoint([5*cos(t)+10 3*sin(t)+10], 'r+'); + Copied: trunk/octave-forge/main/geometry/geom2d/inst/isCounterClockwise.m (from rev 8731, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isCounterClockwise.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/isCounterClockwise.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/isCounterClockwise.m 2011-10-13 17:07:54 UTC (rev 8738) @@ -0,0 +1,156 @@ +%% Copyright (c) 2011, INRA +%% 2010-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{ccw} = } isCounterClockwise (@var{p1}, @var{p2}, @var{p3}) +%% @deftypefnx {Function File} {@var{ccw} = } isCounterClockwise (@var{p1}, @var{p2}, @var{p3},@var{tol}) +%% Compute relative orientation of 3 points +%% +%% Computes the orientation of the 3 points. The returns is: +%% +1 if the path @var{p1}-> @var{p2}-> @var{p3} turns Counter-Clockwise (i.e., the point @var{p3} +%% is located "on the left" of the line @var{p1}- @var{p2}) +%% -1 if the path turns Clockwise (i.e., the point @var{p3} lies "on the right" +%% of the line @var{p1}- @var{p2}) +%% 0 if the point @var{p3} is located on the line segment [ @var{p1} @var{p2}]. +%% +%% This function can be used in more complicated algorithms: detection of +%% line segment intersections, convex hulls, point in triangle... +%% +%% @var{ccw} = isCounterClockwise( @var{p1}, @var{p2}, @var{p3}, EPS); +%% Specifies the threshold used for detecting colinearity of the 3 points. +%% Default value is 1e-12 (absolute). +%% +%% Example +%% +%% @example +%% isCounterClockwise([0 0], [10 0], [10 10]) +%% ans = +%% 1 +%% isCounterClockwise([0 0], [0 10], [10 10]) +%% ans = +%% -1 +%% isCounterClockwise([0 0], [10 0], [5 0]) +%% ans = +%% 0 +%% @end example +%% +%% @seealso{points2d, isPointOnLine, isPointInTriangle} +%% @end deftypefn + +function res = isCounterClockwise(p1, p2, p3, varargin) + + % get threshold value + eps = 1e-12; + if ~isempty(varargin) + eps = varargin{1}; + end + + % ensure all data have same size + np = max([size(p1, 1) size(p2, 1) size(p3,1)]); + if np > 1 + if size(p1,1) == 1 + p1 = repmat(p1, np, 1); + end + if size(p2,1) == 1 + p2 = repmat(p2, np, 1); + end + if size(p3,1) == 1 + p3 = repmat(p3, np, 1); + end + end + + % init with 0 + res = zeros(np, 1); + + % extract vector coordinates + x0 = p1(:, 1); + y0 = p1(:, 2); + dx1 = p2(:, 1) - x0; + dy1 = p2(:, 2) - y0; + dx2 = p3(:, 1) - x0; + dy2 = p3(:, 2) - y0; + + % check non colinear cases + res(dx1 .* dy2 > dy1 .* dx2) = 1; + res(dx1 .* dy2 < dy1 .* dx2) = -1; + + % case of colinear points + ind = abs(dx1 .* dy2 - dy1 .* dx2) < eps; + res(ind( (dx1(ind) .* dx2(ind) < 0) | (dy1(ind) .* dy2(ind) < 0) )) = -1; + res(ind( hypot(dx1(ind), dy1(ind)) < hypot(dx2(ind), dy2(ind)) )) = 1; + +endfunction + +%!shared p0,pu,pd,pl,pr +%! p0 = [2, 3]; % center point +%! pu = [2, 4]; % up point +%! pd = [2, 2]; % down point +%! pl = [1, 3]; % left point +%! pr = [3, 3]; % right point + +%!assert (+1, isCounterClockwise(pl, p0, pu)); +%!assert (+1, isCounterClockwise(pd, p0, pl)); +%!assert (+1, isCounterClockwise(pr, p0, pd)); +%!assert (+1, isCounterClockwise(pu, p0, pr)); + +% turn 90° right => return -1 +%!assert (-1, isCounterClockwise(pl, p0, pd)); +%!assert (-1, isCounterClockwise(pd, p0, pr)); +%!assert (-1, isCounterClockwise(pr, p0, pu)); +%!assert (-1, isCounterClockwise(pu, p0, pl)); + +%!test % turn 90° left => return +1 +%! pts1 = [pl;pd;pr;pu;pl;pd;pr;pu]; +%! pts2 = [p0;p0;p0;p0;p0;p0;p0;p0]; +%! pts3 = [pu;pl;pd;pr;pd;pr;pu;pl]; +%! expected = [1;1;1;1;-1;-1;-1;-1]; +%! result = isCounterClockwise(pts1, pts2, pts3); +%! assert (result, expected, 1e-6); + +% aligned with p0-p1-p2 => return +1 +%!assert (+1, isCounterClockwise(pl, p0, pr)); +%!assert (+1, isCounterClockwise(pu, p0, pd)); +%!assert (+1, isCounterClockwise(pr, p0, pl)); +%!assert (+1, isCounterClockwise(pd, p0, pu)); + +% aligned ]ith p0-p2-p1 => return 0 +%!assert (0, isCounterClockwise(pl, pr, p0)); +%!assert (0, isCounterClockwise(pu, pd, p0)); +%!assert (0, isCounterClockwise(pr, pl, p0)); +%!assert (0, isCounterClockwise(pd, pu, p0)); + +% aligned with p1-p0-p2 => return -1 +%!assert (-1, isCounterClockwise(p0, pl, pr)); +%!assert (-1, isCounterClockwise(p0, pu, pd)); +%!assert (-1, isCounterClockwise(p0, pr, pl)); +%!assert (-1, isCounterClockwise(p0, pr, pl)); Copied: trunk/octave-forge/main/geometry/geom2d/inst/minDistancePoints.m (from rev 8731, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/minDistancePoints.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/minDistancePoints.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/minDistancePoints.m 2011-10-13 17:07:54 UTC (rev 8738) @@ -0,0 +1,280 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{dist} = } minDistancePoints (@var{pts}) +%% @deftypefnx {Function File} {@var{dist} = } minDistancePoints (@var{pts1},@var{pts2}) +%% @deftypefnx {Function File} {@var{dist} = } minDistancePoints (@dots{},@var{norm}) +%% @deftypefnx {Function File} {[@var{dist} @var{i} @var{j}] = } minDistancePoints (@var{pts1}, @var{pts2}, @dots{}) +%% @deftypefnx {Function File} {[@var{dist} @var{j}] = } minDistancePoints (@var{pts1}, @var{pts2}, @dots{}) +%% Minimal distance between several points. +%% +%% Returns the minimum distance between all couple of points in @var{pts}. var{pts} is +%% an array of [NxND] values, N being the number of points and ND the +%% dimension of the points. +%% +%% Computes for each point in @var{pts1} the minimal distance to every point of +%% @var{pts2}. @var{pts1} and @var{pts2} are [NxD] arrays, where N is the number of points, +%% and D is the dimension. Dimension must be the same for both arrays, but +%% number of points can be different. +%% The result is an array the same length as @var{pts1}. +%% +%% When @var{norm} is provided, it uses a user-specified norm. @var{norm}=2 means euclidean norm (the default), +%% @var{norm}=1 is the Manhattan (or "taxi-driver") distance. +%% Increasing @var{norm} growing up reduces the minimal distance, with a limit +%% to the biggest coordinate difference among dimensions. +%% +%% +%% Returns indices I and J of the 2 points which are the closest. @var{dist} +%% verifies relation: +%% @var{dist} = distancePoints(@var{pts}(@var{i},:), @var{pts}(@var{j},:)); +%% +%% If only 2 output arguments are given, it returns the indices of points which are the closest. J has the +%% same size as @var{dist}. for each I It verifies the relation : +%% @var{dist}(I) = distancePoints(@var{pts1}(I,:), @var{pts2}(@var{J},:)); +%% +%% +%% Examples: +%% +%% @example +%% % minimal distance between random planar points +%% points = rand(20,2)*100; +%% minDist = minDistancePoints(points); +%% +%% % minimal distance between random space points +%% points = rand(30,3)*100; +%% [minDist ind1 ind2] = minDistancePoints(points); +%% minDist +%% distancePoints(points(ind1, :), points(ind2, :)) +%% % results should be the same +%% +%% % minimal distance between 2 sets of points +%% points1 = rand(30,2)*100; +%% points2 = rand(30,2)*100; +%% [minDists inds] = minDistancePoints(points1, points2); +%% minDists(10) +%% distancePoints(points1(10, :), points2(inds(10), :)) +%% % results should be the same +%% @end example +%% +%% @seealso{points2d, distancePoints} +%% @end deftypefn + +function varargout = minDistancePoints(p1, varargin) + + %% Initialisations + + % default norm (euclidean) + n = 2; + + % flag for processing of all points + allPoints = false; + + % process input variables + if isempty(varargin) + % specify only one array of points, not the norm + p2 = p1; + + elseif length(varargin)==1 + var = varargin{1}; + if length(var)>1 + % specify two arrays of points + p2 = var; + allPoints = true; + else + % specify array of points and the norm + n = var; + p2 = p1; + end + + else + % specify two array of points and the norm + p2 = varargin{1}; + n = varargin{2}; + allPoints = true; + end + + + % number of points in each array + n1 = size(p1, 1); + n2 = size(p2, 1); + + % dimension of points + d = size(p1, 2); + + + %% Computation of distances + + % allocate memory + dist = zeros(n1, n2); + + % different behaviour depending on the norm used + if n==2 + % Compute euclidian distance. this is the default case + % Compute difference of coordinate for each pair of point ([n1*n2] array) + % and for each dimension. -> dist is a [n1*n2] array. + % in 2D: dist = dx.*dx + dy.*dy; + for i=1:d + dist = dist + (repmat(p1(:,i), [1 n2])-repmat(p2(:,i)', [n1 1])).^2; + end + + % compute minimal distance: + if ~allPoints + % either on all couple of points + mat = repmat((1:n1)', [1 n1]); + ind = mat < mat'; + [minSqDist ind] = min(dist(ind)); + else + % or for each point of P1 + [minSqDist ind] = min(dist, [], 2); + end + + % convert squared distance to distance + minDist = sqrt(minSqDist); + elseif n==inf + % infinite norm corresponds to maximum absolute value of differences + % in 2D: dist = max(abs(dx) + max(abs(dy)); + for i=1:d + dist = max(dist, abs(p1(:,i)-p2(:,i))); + end + else + % compute distance using the specified norm. + % in 2D: dist = power(abs(dx), n) + power(abs(dy), n); + for i=1:d + dist = dist + power((abs(repmat(p1(:,i), [1 n2])-repmat(p2(:,i)', [n1 1]))), n); + end + + % compute minimal distance + if ~allPoints + % either on all couple of points + mat = repmat((1:n1)', [1 n1]); + ind = mat < mat'; + [minSqDist ind] = min(dist(ind)); + else + % or for each point of P1 + [minSqDist ind] = min(dist, [], 2); + end + + % convert squared distance to distance + minDist = power(minSqDist, 1/n); + end + + + + if ~allPoints + % convert index in array to row ad column subindices. + % This uses the fact that index are sorted in a triangular matrix, + % with the last index of each column being a so-called triangular + % number + ind2 = ceil((-1+sqrt(8*ind+1))/2); + ind1 = ind - ind2*(ind2-1)/2; + ind2 = ind2 + 1; + end + + + %% format output parameters + + % format output depending on number of asked parameters + if nargout<=1 + varargout{1} = minDist; + elseif nargout==2 + % If two arrays are asked, 'ind' is an array of indices, one for each + % point in var{pts}1, corresponding to the result in minDist + varargout{1} = minDist; + varargout{2} = ind; + elseif nargout==3 + % If only one array is asked, minDist is a scalar, ind1 and ind2 are 2 + % indices corresponding to the closest points. + varargout{1} = minDist; + varargout{2} = ind1; + varargout{3} = ind2; + end + +endfunction + +%!test +%! pts = [50 10;40 60;30 30;20 0;10 60;10 30;0 10]; +%! assert (minDistancePoints(pts), 20); + +%!test +%! pts = [10 10;25 5;20 20;30 20;10 30]; +%! [dist ind1 ind2] = minDistancePoints(pts); +%! assert (10, dist, 1e-6); +%! assert (3, ind1, 1e-6); +%! assert (4, ind2, 1e-6); + +%!test +%! pts = [0 80;10 60;20 40;30 20;40 0;0 0;100 0;0 100;0 -10;-10 -20]; +%! assert (minDistancePoints([40 50], pts), 10*sqrt(5), 1e-6); +%! assert (minDistancePoints([25 30], pts), 5*sqrt(5), 1e-6); +%! assert (minDistancePoints([30 40], pts), 10, 1e-6); +%! assert (minDistancePoints([20 40], pts), 0, 1e-6); + +%!test +%! pts1 = [40 50;25 30;40 20]; +%! pts2 = [0 80;10 60;20 40;30 20;40 0;0 0;100 0;0 100;0 -10;-10 -20]; +%! res = [10*sqrt(5);5*sqrt(5);10]; +%! assert (minDistancePoints(pts1, pts2), res, 1e-6); + +%!test +%! pts = [50 10;40 60;40 30;20 0;10 60;10 30;0 10]; +%! assert (minDistancePoints(pts, 1), 30, 1e-6); +%! assert (minDistancePoints(pts, 100), 20, 1e-6); + +%!test +%! pts = [0 80;10 60;20 40;30 20;40 0;0 0;100 0;0 100;0 -10;-10 -20]; +%! assert (minDistancePoints([40 50], pts, 2), 10*sqrt(5), 1e-6); +%! assert (minDistancePoints([25 30], pts, 2), 5*sqrt(5), 1e-6); +%! assert (minDistancePoints([30 40], pts, 2), 10, 1e-6); +%! assert (minDistancePoints([20 40], pts, 2), 0, 1e-6); +%! assert (minDistancePoints([40 50], pts, 1), 30, 1e-6); +%! assert (minDistancePoints([25 30], pts, 1), 15, 1e-6); +%! assert (minDistancePoints([30 40], pts, 1), 10, 1e-6); +%! assert (minDistancePoints([20 40], pts, 1), 0, 1e-6); + +%!test +%! pts1 = [40 50;25 30;40 20]; +%! pts2 = [0 80;10 60;20 40;30 20;40 0;0 0;100 0;0 100;0 -10;-10 -20]; +%! res1 = [10*sqrt(5);5*sqrt(5);10]; +%! assert (minDistancePoints(pts1, pts2, 2), res1, 1e-6); +%! res2 = [30;15;10]; +%! assert (minDistancePoints(pts1, pts2, 1), res2); + +%!test +%! pts1 = [40 50;20 30;40 20]; +%! pts2 = [0 80;10 60;20 40;30 20;40 0;0 0;100 0;0 100;0 -10;-10 -20]; +%! dists0 = [10*sqrt(5);10;10]; +%! inds1 = [3;3;4]; +%! [minDists inds] = minDistancePoints(pts1, pts2); +%! assert (dists0, minDists); +%! assert (inds1, inds); Copied: trunk/octave-forge/main/geometry/geom2d/inst/pointOnLine.m (from rev 8731, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/pointOnLine.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/pointOnLine.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/pointOnLine.m 2011-10-13 17:07:54 UTC (rev 8738) @@ -0,0 +1,53 @@ +%% Copyright (c) 2011, INRA +%% 2004-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} {@var{point} = } pointOnLine (@var{line}, @var{d}) +%% Create a point on a line at a given position on the line. +%% +%% Creates the point belonging to the line @var{line}, and located at the +%% distance @var{d} from the line origin. +%% @var{line} has the form [x0 y0 dx dy]. +%% @var{line} and @var{d} should have the same number N of rows. The result will have +%% N rows and 2 column (x and y positions). +%% +%% @seealso{lines2d, points2d, onLine, onLine, linePosition} +%% @end deftypefn + +function point = pointOnLine(lin, pos) + + ang = lineAngle(lin); + point = [lin(:,1) + pos .* cos(ang), lin(:,2) + pos .* sin(ang)]; + +endfunction + Copied: trunk/octave-forge/main/geometry/geom2d/inst/points2d.m (from rev 8731, trunk/octave-forge/main/geometry/matGeom_raw/geom2d/points2d.m) =================================================================== --- trunk/octave-forge/main/geometry/geom2d/inst/points2d.m (rev 0) +++ trunk/octave-forge/main/geometry/geom2d/inst/points2d.m 2011-10-13 17:07:54 UTC (rev 8738) @@ -0,0 +1,60 @@ +%% Copyright (c) 2011, INRA +%% 2008-2011, David Legland <dav...@gr...> +%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> +%% +%% All rights reserved. +%% (simplified BSD License) +%% +%% Redistribution and use in source and binary forms, with or without +%% modification, are permitted provided that the following conditions are met: +%% +%% 1. Redistributions of source code must retain the above copyright notice, this +%% list of conditions and the following disclaimer. +%% +%% 2. Redistributions in binary form must reproduce the above copyright notice, +%% this list of conditions and the following disclaimer in the documentation +%% and/or other materials provided with the distribution. +%% +%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +%% POSSIBILITY OF SUCH DAMAGE. +%% +%% The views and conclusions contained in the software and documentation are +%% those of the authors and should not be interpreted as representing official +%% policies, either expressed or implied, of copyright holder. + +%% -*- texinfo -*- +%% @deftypefn {Function File} points2d () +%% Description of functions operating on points. +%% +%% A point is defined by its two cartesian coordinate, put into a row +%% vector of 2 elements: +%% P = [x y]; +%% +%% Several points are stores in a matrix with two columns, one for the +%% x-coordinate, one for the y-coordinate. +%% PTS = [x1 y1 ; x2 y2 ; x3 y3]; +%% +%% Example +%% P = [5 6]; +%% +%% @seealso{centroid, midPoint, polarPoint, pointOnLine +%% isCounterClockwise, angle2Points, angle3Points, angleSort +%% distancePoints, minDistancePoints +%% transformPoint, clipPoints, drawPoint} +%% @end deftypefn + +function points2d + + help('points2d'); + +endfunction + Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIsCounterClockwise.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIsCounterClockwise.m 2011-10-13 07:43:26 UTC (rev 8737) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testIsCounterClockwise.m 2011-10-13 17:07:54 UTC (rev 8738) @@ -1,103 +0,0 @@ -function test_suite = testIsCounterClockwise -%test orientation of 3 points -% output = testEq(input) -% -% Example -% testEq -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-03, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - -function testCcwTurnLeft -% turn 90\xB0 left => return +1 - -p0 = [2, 3]; % center point -pu = [2, 4]; % up point -pd = [2, 2]; % down point -pl = [1, 3]; % left point -pr = [3, 3]; % right point - -assertEqual(isCounterClockwise(pl, p0, pu), +1); -assertEqual(isCounterClockwise(pd, p0, pl), +1); -assertEqual(isCounterClockwise(pr, p0, pd), +1); -assertEqual(isCounterClockwise(pu, p0, pr), +1); - -function testCcwTurnRight -% turn 90\xB0 right => return -1 - -p0 = [2, 3]; % center point -pu = [2, 4]; % up point -pd = [2, 2]; % down point -pl = [1, 3]; % left point -pr = [3, 3]; % right point - -assertEqual(isCounterClockwise(pl, p0, pd), -1); -assertEqual(isCounterClockwise(pd, p0, pr), -1); -assertEqual(isCounterClockwise(pr, p0, pu), -1); -assertEqual(isCounterClockwise(pu, p0, pl), -1); - -function testCcwTurnLeftArray -% turn 90\xB0 left => return +1 - -p0 = [2, 3]; % center point -pu = [2, 4]; % up point -pd = [2, 2]; % down point -pl = [1, 3]; % left point -pr = [3, 3]; % right point - -pts1 = [pl;pd;pr;pu;pl;pd;pr;pu]; -pts2 = [p0;p0;p0;p0;p0;p0;p0;p0]; -pts3 = [pu;pl;pd;pr;pd;pr;pu;pl]; -expected = [1;1;1;1;-1;-1;-1;-1]; -result = isCounterClockwise(pts1, pts2, pts3); -assertElementsAlmostEqual(expected, result); - -function testCcwCol1 -% aligned with p0-p1-p2 => return +1 - -p0 = [2, 3]; % center point -pu = [2, 4]; % up point -pd = [2, 2]; % down point -pl = [1, 3]; % left point -pr = [3, 3]; % right point - -assertEqual(isCounterClockwise(pl, p0, pr), +1); -assertEqual(isCounterClockwise(pu, p0, pd), +1); -assertEqual(isCounterClockwise(pr, p0, pl), +1); -assertEqual(isCounterClockwise(pd, p0, pu), +1); - -function testCcwCol0 -% aligned ]ith p0-p2-p1 => return 0 -p0 = [2, 3]; % center point -pu = [2, 4]; % up point -pd = [2, 2]; % down point -pl = [1, 3]; % left point -pr = [3, 3]; % right point - -assertEqual(isCounterClockwise(pl, pr, p0), 0); -assertEqual(isCounterClockwise(pu, pd, p0), 0); -assertEqual(isCounterClockwise(pr, pl, p0), 0); -assertEqual(isCounterClockwise(pd, pu, p0), 0); - -function testCcwColM1 -% aligned with p1-p0-p2 => return -1 -p0 = [2, 3]; % center point -pu = [2, 4]; % up point -pd = [2, 2]; % down point -pl = [1, 3]; % left point -pr = [3, 3]; % right point - -assertEqual(isCounterClockwise(p0, pl, pr), -1); -assertEqual(isCounterClockwise(p0, pu, pd), -1); -assertEqual(isCounterClockwise(p0, pr, pl), -1); -assertEqual(isCounterClockwise(p0, pd, pu), -1); - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testMinDistancePoints.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testMinDistancePoints.m 2011-10-13 07:43:26 UTC (rev 8737) +++ trunk/octave-forge/main/geometry/matGeom_raw/Tests/geom2d/testMinDistancePoints.m 2011-10-13 17:07:54 UTC (rev 8738) @@ -1,89 +0,0 @@ -function test_suite = testMinDistancePoints(varargin) -%TESTMINDISTANCEPOINTS One-line description here, please. -% output = testMinDistancePoints(input) -% -% Example -% testMinDistancePoints -% -% See also -% -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2009-04-22, using Matlab 7.7.0.471 (R2008b) -% Copyright 2009 INRA - Cepia Software Platform. -% Licensed under the terms of the LGPL, see the file "license.txt" - -initTestSuite; - -function testArray - -pts = [50 10;40 60;30 30;20 0;10 60;10 30;0 10]; -assertElementsAlmostEqual(minDistancePoints(pts), 20); - -function testArrayIndInd - -pts = [10 10;25 5;20 20;30 20;10 30]; -[dist ind1 ind2] = minDistancePoints(pts); -assertAlmostEqual(10, dist); -assertAlmostEqual(3, ind1); -assertAlmostEqual(4, ind2); - - -function testPointArray - -pts = [0 80;10 60;20 40;30 20;40 0;0 0;100 0;0 100;0 -10;-10 -20]; -assertElementsAlmostEqual(minDistancePoints([40 50], pts), 10*sqrt(5)); -assertElementsAlmostEqual(minDistancePoints([25 30], pts), 5*sqrt(5)); -assertElementsAlmostEqual(minDistancePoints([30 40], pts), 10); -assertElementsAlmostEqual(minDistancePoints([20 40], pts), 0); - -function testArrayArray - -pts1 = [40 50;25 30;40 20]; -pts2 = [0 80;10 60;20 40;30 20;40 0;0 0;100 0;0 100;0 -10;-10 -20]; -res = [10*sqrt(5);5*sqrt(5);10]; -assertElementsAlmostEqual(minDistancePoints(pts1, pts2), res); - - - -function testArrayNorm - -pts = [50 10;40 60;40 30;20 0;10 60;10 30;0 10]; -assertElementsAlmostEqual(minDistancePoints(pts, 1), 30); -assertElementsAlmostEqual(minDistancePoints(pts, 100), 20); - - -function testPointArrayNorm - -pts = [0 80;10 60;20 40;30 20;40 0;0 0;100 0;0 100;0 -10;-10 -20]; -assertElementsAlmostEqual(minDistancePoints([40 50], pts, 2), 10*sqrt(5)); -assertElementsAlmostEqual(minDistancePoints([25 30], pts, 2), 5*sqrt(5)); -assertElementsAlmostEqual(minDistancePoints([30 40], pts, 2), 10); -assertElementsAlmostEqual(minDistancePoints([20 40], pts, 2), 0); -assertElementsAlmostEqual(minDistancePoints([40 50], pts, 1), 30); -assertElementsAlmostEqual(minDistancePoints([25 30], pts, 1), 15); -assertElementsAlmostEqual(minDistancePoints([30 40], pts, 1), 10); -assertElementsAlmostEqual(minDistancePoints([20 40], pts, 1), 0); - -function testArrayArrayNorm - -pts1 = [40 50;25 30;40 20]; -pts2 = [0 80;10 60;20 40;30 20;40 0;0 0;100 0;0 100;0 -10;-10 -20]; -res1 = [10*sqrt(5);5*sqrt(5);10]; -assertElementsAlmostEqual(minDistancePoints(pts1, pts2, 2), res1); - -res2 = [30;15;10]; -assertElementsAlmostEqual(minDistancePoints(pts1, pts2, 1), res2); - -function testArrayArrayIndices - -pts1 = [40 50;20 30;40 20]; -pts2 = [0 80;10 60;20 40;30 20;40 0;0 0;100 0;0 100;0 -10;-10 -20]; -dists0 = [10*sqrt(5);10;10]; -inds1 = [3;3;4]; -[minDists inds] = minDistancePoints(pts1, pts2); -assertElementsAlmostEqual(dists0, minDists); -assertElementsAlmostEqual(inds1, inds); - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m 2011-10-13 07:43:26 UTC (rev 8737) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/drawPoint.m 2011-10-13 17:07:54 UTC (rev 8738) @@ -1,103 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - -function varargout = drawPoint(varargin) -%DRAWPOINT Draw the point on the axis. -% -% drawPoint(X, Y); -% Draws points defined by coordinates X and Y. -% X and Y should be array the same size. -% -% drawPoint(COORD); -% Packs coordinates in a single [N*2] array. -% -% drawPoint(..., OPT); -% Draws each point with given option. OPT is a series of arguments pairs -% compatible with 'plot' model. -% -% -% H = drawPoint(...) also return a handle to each of the drawn points. -% -% Example -% drawPoint(10, 10); -% -% t = linspace(0, 2*pi, 20)'; -% drawPoint([5*cos(t)+10 3*sin(t)+10], 'r+'); -% -% See also -% points2d, clipPoints -% -% --------- -% -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 31/10/2003. -% - -% HISTORY -% 23/02/2004 add more documentation. Manage different kind of inputs. -% Does not draw points outside visible area. -% 26/02/2007 update processing of input arguments. -% 30/04/2009 remove clipping of points (use clipPoints if necessary) - -% process input arguments -var = varargin{1}; -if size(var, 2)==1 - % points stored in separate arrays - px = varargin{1}; - py = varargin{2}; - varargin(1:2) = []; -else - % points packed in one array - px = var(:, 1); - py = var(:, 2); - varargin(1) = []; -end - -% ensure we have column vectors -px = px(:); -py = py(:); - -% default drawing options, but keep specified options if it has the form of -% a bundled string -if length(varargin)~=1 - varargin = [{'linestyle', 'none', 'marker', 'o', 'color', 'b'}, varargin]; -end - -% plot the points, using specified drawing options -h = plot(px(:), py(:), varargin{:}); - -% process output arguments -if nargout>0 - varargout{1}=h; -end Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isCounterClockwise.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isCounterClockwise.m 2011-10-13 07:43:26 UTC (rev 8737) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/isCounterClockwise.m 2011-10-13 17:07:54 UTC (rev 8738) @@ -1,119 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function res = isCounterClockwise(p1, p2, p3, varargin) -%ISCOUNTERCLOCKWISE Compute relative orientation of 3 points -% -% CCW = isCounterClockwise(P1, P2, P3); -% Computes the orientation of the 3 points. The returns is: -% +1 if the path P1->P2->P3 turns Counter-Clockwise (i.e., the point P3 -% is located "on the left" of the line P1-P2) -% -1 if the path turns Clockwise (i.e., the point P3 lies "on the right" -% of the line P1-P2) -% 0 if the point P3 is located on the line segment [P1 P2]. -% -% This function can be used in more complicated algorithms: detection of -% line segment intersections, convex hulls, point in triangle... -% -% CCW = isCounterClockwise(P1, P2, P3, EPS); -% Specifies the threshold used for detecting colinearity of the 3 points. -% Default value is 1e-12 (absolute). -% -% Example -% isCounterClockwise([0 0], [10 0], [10 10]) -% ans = -% 1 -% isCounterClockwise([0 0], [0 10], [10 10]) -% ans = -% -1 -% isCounterClockwise([0 0], [10 0], [5 0]) -% ans = -% 0 -% -% See also -% points2d, isPointOnLine, isPointInTriangle -% -% References -% Algorithm adapated from Sedgewick's book. -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2010-04-09 -% Copyright 2011 INRA - Cepia Software Platform. - - -% HISTORY -% 2011-05-16 change variable names, add support for point arrays - - -% get threshold value -eps = 1e-12; -if ~isempty(varargin) - eps = varargin{1}; -end - -% ensure all data have same size -np = max([size(p1, 1) size(p2, 1) size(p3,1)]); -if np > 1 - if size(p1,1) == 1 - p1 = repmat(p1, np, 1); - end - if size(p2,1) == 1 - p2 = repmat(p2, np, 1); - end - if size(p3,1) == 1 - p3 = repmat(p3, np, 1); - end -end - -% init with 0 -res = zeros(np, 1); - -% extract vector coordinates -x0 = p1(:, 1); -y0 = p1(:, 2); -dx1 = p2(:, 1) - x0; -dy1 = p2(:, 2) - y0; -dx2 = p3(:, 1) - x0; -dy2 = p3(:, 2) - y0; - -% check non colinear cases -res(dx1 .* dy2 > dy1 .* dx2) = 1; -res(dx1 .* dy2 < dy1 .* dx2) = -1; - -% case of colinear points -ind = abs(dx1 .* dy2 - dy1 .* dx2) < eps; -res(ind( (dx1(ind) .* dx2(ind) < 0) | (dy1(ind) .* dy2(ind) < 0) )) = -1; -res(ind( hypot(dx1(ind), dy1(ind)) < hypot(dx2(ind), dy2(ind)) )) = 1; Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/minDistancePoints.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/minDistancePoints.m 2011-10-13 07:43:26 UTC (rev 8737) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/minDistancePoints.m 2011-10-13 17:07:54 UTC (rev 8738) @@ -1,235 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function varargout = minDistancePoints(p1, varargin) -%MINDISTANCEPOINTS Minimal distance between several points -% -% DIST = minDistancePoints(PTS) -% Returns the minimum distance between all couple of points in PTS. PTS is -% an array of [NxND] values, N being the number of points and ND the -% dimension of the points. -% -% DIST = minDistancePoints(PTS1, PTS2) -% Computes for each point in PTS1 the minimal distance to every point of -% PTS2. PTS1 and PTS2 are [NxD] arrays, where N is the number of points, -% and D is the dimension. Dimension must be the same for both arrays, but -% number of points can be different. -% The result is an array the same length as PTS1. -% -% -% DIST = minDistancePoints(..., NORM) -% Uses a user-specified norm. NORM=2 means euclidean norm (the default), -% NORM=1 is the Manhattan (or "taxi-driver") distance. -% Increasing NORM growing up reduces the minimal distance, with a limit -% to the biggest coordinate difference among dimensions. -% -% -% [DIST I J] = minDistancePoints(PTS) -% Returns indices I and J of the 2 points which are the closest. DIST -% verifies relation: -% DIST = distancePoints(PTS(I,:), PTS(J,:)); -% -% [DIST J] = minDistancePoints(PTS1, PTS2, ...) -% Also returns the indices of points which are the closest. J has the -% same size as DIST. It verifies relation : -% DIST(I) = distancePoints(PTS1(I,:), PTS2(J,:)); -% -% -% Examples: -% % minimal distance between random planar points -% points = rand(20,2)*100; -% minDist = minDistancePoints(points); -% -% % minimal distance between random space points -% points = rand(30,3)*100; -% [minDist ind1 ind2] = minDistancePoints(points); -% minDist -% distancePoints(points(ind1, :), points(ind2, :)) -% % results should be the same -% -% % minimal distance between 2 sets of points -% points1 = rand(30,2)*100; -% points2 = rand(30,2)*100; -% [minDists inds] = minDistancePoints(points1, points2); -% minDists(10) -% distancePoints(points1(10, :), points2(inds(10), :)) -% % results should be the same -% -% See Also -% points2d, distancePoints -% -% --------- -% author: David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 15/06/2004. -% - -% HISTORY: -% 22/06/2005 compute sqrt only at the end (faster), and change behaviour -% for 2 inputs: compute min distance for each point in PTS1. -% Also add support for different norms. -% 15/08/2005 make difference when 1 array or 2 arrays of points -% 25/10/2006 also returns indices of closest points -% 30/10/2006 generalize to points of any dimension -% 28/08/2007 code cleanup, add comments and help - - -%% Initialisations - -% default norm (euclidean) -n = 2; - -% flag for processing of all points -allPoints = false; - -% process input variables -if isempty(varargin) - % specify only one array of points, not the norm - p2 = p1; - -elseif length(varargin)==1 - var = varargin{1}; - if length(var)>1 - % specify two arrays of points - p2 = var; - allPoints = true; - else - % specify array of points and the norm - n = var; - p2 = p1; - end - -else - % specify two array of points and the norm - p2 = varargin{1}; - n = varargin{2}; - allPoints = true; -end - - -% number of points in each array -n1 = size(p1, 1); -n2 = size(p2, 1); - -% dimension of points -d = size(p1, 2); - - -%% Computation of distances - -% allocate memory -dist = zeros(n1, n2); - -% different behaviour depending on the norm used -if n==2 - % Compute euclidian distance. this is the default case - % Compute difference of coordinate for each pair of point ([n1*n2] array) - % and for each dimension. -> dist is a [n1*n2] array. - % in 2D: dist = dx.*dx + dy.*dy; - for i=1:d - dist = dist + (repmat(p1(:,i), [1 n2])-repmat(p2(:,i)', [n1 1])).^2; - end - - % compute minimal distance: - if ~allPoints - % either on all couple of points - mat = repmat((1:n1)', [1 n1]); - ind = mat < mat'; - [minSqDist ind] = min(dist(ind)); - else - % or for each point of P1 - [minSqDist ind] = min(dist, [], 2); - end - - % convert squared distance to distance - minDist = sqrt(minSqDist); -elseif n==inf - % infinite norm corresponds to maximum absolute value of differences - % in 2D: dist = max(abs(dx) + max(abs(dy)); - for i=1:d - dist = max(dist, abs(p1(:,i)-p2(:,i))); - end -else - % compute distance using the specified norm. - % in 2D: dist = power(abs(dx), n) + power(abs(dy), n); - for i=1:d - dist = dist + power((abs(repmat(p1(:,i), [1 n2])-repmat(p2(:,i)', [n1 1]))), n); - end - - % compute minimal distance - if ~allPoints - % either on all couple of points - mat = repmat((1:n1)', [1 n1]); - ind = mat < mat'; - [minSqDist ind] = min(dist(ind)); - else - % or for each point of P1 - [minSqDist ind] = min(dist, [], 2); - end - - % convert squared distance to distance - minDist = power(minSqDist, 1/n); -end - - - -if ~allPoints - % convert index in array to row ad column subindices. - % This uses the fact that index are sorted in a triangular matrix, - % with the last index of each column being a so-called triangular - % number - ind2 = ceil((-1+sqrt(8*ind+1))/2); - ind1 = ind - ind2*(ind2-1)/2; - ind2 = ind2 + 1; -end - - -%% format output parameters - -% format output depending on number of asked parameters -if nargout<=1 - varargout{1} = minDist; -elseif nargout==2 - % If two arrays are asked, 'ind' is an array of indices, one for each - % point in PTS1, corresponding to the result in minDist - varargout{1} = minDist; - varargout{2} = ind; -elseif nargout==3 - % If only one array is asked, minDist is a scalar, ind1 and ind2 are 2 - % indices corresponding to the closest points. - varargout{1} = minDist; - varargout{2} = ind1; - varargout{3} = ind2; -end - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/pointOnLine.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/pointOnLine.m 2011-10-13 07:43:26 UTC (rev 8737) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/pointOnLine.m 2011-10-13 17:07:54 UTC (rev 8738) @@ -1,58 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function point = pointOnLine(line, pos) -%POINTONLINE Create a point on a line at a given position on the line -% -% P = pointOnLine(LINE, POS); -% Creates the point belonging to the line LINE, and located at the -% distance D from the line origin. -% LINE has the form [x0 y0 dx dy]. -% LINE and D should have the same number N of rows. The result will have -% N rows ans 2 column (x and y positions). -% -% See also: -% lines2d, points2d, onLine, onLine, linePosition -% -% --------- -% -% author : David Legland -% INRA - TPV URPOI - BIA IMASTE -% created the 07/04/2004. -% - - -angle = lineAngle(line); -point = [line(:,1) + pos .* cos(angle), line(:,2) + pos .* sin(angle)]; - Deleted: trunk/octave-forge/main/geometry/matGeom_raw/geom2d/points2d.m =================================================================== --- trunk/octave-forge/main/geometry/matGeom_raw/geom2d/points2d.m 2011-10-13 07:43:26 UTC (rev 8737) +++ trunk/octave-forge/main/geometry/matGeom_raw/geom2d/points2d.m 2011-10-13 17:07:54 UTC (rev 8738) @@ -1,61 +0,0 @@ -%% Copyright (c) 2011, INRA -%% 2007-2011, David Legland <dav...@gr...> -%% 2011 Adapted to Octave by Juan Pablo Carbajal <car...@if...> -%% -%% All rights reserved. -%% (simplified BSD License) -%% -%% Redistribution and use in source and binary forms, with or without -%% modification, are permitted provided that the following conditions are met: -%% -%% 1. Redistributions of source code must retain the above copyright notice, this -%% list of conditions and the following disclaimer. -%% -%% 2. Redistributions in binary form must reproduce the above copyright notice, -%% this list of conditions and the following disclaimer in the documentation -%% and/or other materials provided with the distribution. -%% -%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -%% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -%% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -%% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -%% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -%% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -%% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -%% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -%% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -%% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -%% POSSIBILITY OF SUCH DAMAGE. -%% -%% The views and conclusions contained in the software and documentation are -%% those of the authors and should not be interpreted as representing official -%% policies, either expressed or implied, of copyright holder. - - -function points2d -%POINTS2D Description of functions operating on points -% -% A point is defined by its two cartesian coordinate, put into a row -% vector of 2 elements: -% P = [x y]; -% -% Several points are stores in a matrix with two columns, one for the -% x-coordinate, one for the y-coordinate. -% PTS = [x1 y1 ; x2 y2 ; x3 y3]; -% -% Example -% P = [5 6]; -% -% See also: -% centroid, midPoint, polarPoint, pointOnLine -% isCounterClockwise, angle2Points, angle3Points, angleSort -% distancePoints, minDistancePoints -% transformPoint, clipPoints, drawPoint -% -% ------ -% Author: David Legland -% e-mail: dav...@gr... -% Created: 2008-10-13, using Matlab 7.4.0.287 (R2007a) -% Copyright 2008 INRA - BIA PV Nantes - MIAJ Jouy-en-Josas. - -help('points2d'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jpi...@us...> - 2011-10-13 17:11:29
|
Revision: 8739 http://octave.svn.sourceforge.net/octave/?rev=8739&view=rev Author: jpicarbajal Date: 2011-10-13 17:11:20 +0000 (Thu, 13 Oct 2011) Log Message: ----------- geometry. NEWS and INDEX Modified Paths: -------------- trunk/octave-forge/main/geometry/INDEX trunk/octave-forge/main/geometry/doc/NEWS Modified: trunk/octave-forge/main/geometry/INDEX =================================================================== --- trunk/octave-forge/main/geometry/INDEX 2011-10-13 17:07:54 UTC (rev 8738) +++ trunk/octave-forge/main/geometry/INDEX 2011-10-13 17:11:20 UTC (rev 8739) @@ -8,33 +8,53 @@ angleSort boxes2d cbezier2poly + centroid clipEdge clipLine clipPoints clipRay + createBasisTransform + createHomothecy createLine + createLineReflection createRay + createRotation + createScaling + createTranslation deg2rad + distancePoints drawBezierCurve drawBox drawEdge drawLine + drawPoint drawRay edgeAngle + fitAffineTransform2d intersectBoxes intersectLines + isCounterClockwise isParallel isPerpendicular isPointOnRay lineAngle linePosition mergeBoxes + midPoint + minDistancePoints normalizeAngle normalizeVector + pointOnLine + points2d + polarPoint rad2deg randomPointInBox rays2d rotateVector + transformEdge + transformLine + transformPoint + transforms2d transformVector vectorAngle vectorNorm Modified: trunk/octave-forge/main/geometry/doc/NEWS =================================================================== --- trunk/octave-forge/main/geometry/doc/NEWS 2011-10-13 17:07:54 UTC (rev 8738) +++ trunk/octave-forge/main/geometry/doc/NEWS 2011-10-13 17:11:20 UTC (rev 8739) @@ -73,7 +73,7 @@ geometry-1.1.3 Release Date: 2011-10-10 Release Manager: Juan Pablo Carbajal =============================================================================== -* Continue to add geom2d from matGeom (transforms) +* Continue to add geom2d from matGeom (transforms and points2d) createBasisTransform.m createHomothecy.m createLineReflection.m @@ -89,5 +89,10 @@ distancePoints.m midPoint.m polarPoint.m + drawPoint.m + isCounterClockwise.m + minDistancePoints.m + pointOnLine.m + points2d.m =============================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |