diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 6d7f58c0..de04dba0 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -57,7 +57,7 @@ jobs: CIBW_ENVIRONMENT: "MAX_JOBS=${{ matrix.os.runs-on == 'macos-latest' && 3 || 2 }}" # Why universal2 here? It's not included above in CIBW_BUILD CIBW_ARCHS_MACOS: "x86_64 arm64 universal2" - CIBW_ENVIRONMENT_MACOS: "CMAKE_OSX_ARCHITECTURES=\"${{ matrix.os.cibw-arch == 'macosx_x86_64' && 'x86_64' || matrix.os.cibw-arch == 'macosx_arm64' && 'arm64' || matrix.os.cibw-arch == 'macosx_universal2' && 'arm64;x86_64' || '' }}\"" + CIBW_ENVIRONMENT_MACOS: "MACOSX_DEPLOYMENT_TARGET=10.13 CMAKE_OSX_ARCHITECTURES=\"${{ matrix.os.cibw-arch == 'macosx_x86_64' && 'x86_64' || matrix.os.cibw-arch == 'macosx_arm64' && 'arm64' || matrix.os.cibw-arch == 'macosx_universal2' && 'arm64;x86_64' || '' }}\"" steps: diff --git a/CMakeLists.txt b/CMakeLists.txt index 1cdffc69..47e4feb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ include(CXXFeatures) set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE INTERNAL "") option(LIBIGL_COPYLEFT_CGAL "Build target igl_copyleft::cgal" ON) +option(LIBIGL_RESTRICTED_TRIANGLE "Build target igl_restricted::triangle" ON) # libigl options must come before include(PyiglDependencies) include(PyiglDependencies) if(NOT TARGET igl::core) @@ -79,17 +80,23 @@ function(pyigl_include prefix name) target_link_libraries( pyigl INTERFACE ${target_name}) endif() # https://stackoverflow.com/a/69736197/148668 + # https://cmake.org/cmake/help/latest/manual/cmake.1.html#cmdoption-cmake-E-arg-copy + # until then just needlessly also copy TARGET_FILE in case TARGET_RUNTIME_DLLS is empty if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") add_custom_command(TARGET ${target_name} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMAND ${CMAKE_COMMAND} -E copy $ $ $ COMMAND_EXPAND_LISTS) endif() endfunction() pyigl_include("copyleft" "cgal") +pyigl_include("restricted" "triangle") -add_library(pyigl_classes MODULE classes/classes.cpp) +file(GLOB PYIGL_CLASSES_SOURCES classes/*.cpp) +add_library(pyigl_classes MODULE ${PYIGL_CLASSES_SOURCES}) +# std::variant +target_compile_features(pyigl_classes PRIVATE cxx_std_17) target_link_libraries(pyigl_classes PRIVATE npe igl::core) target_link_libraries(pyigl_classes PRIVATE pybind11::module) set_target_properties(pyigl_classes PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}" SUFFIX "${PYTHON_MODULE_EXTENSION}") diff --git a/LICENSE.GPL b/LICENSE.GPL new file mode 100644 index 00000000..94a9ed02 --- /dev/null +++ b/LICENSE.GPL @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + 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. + + + Copyright (C) + + 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 . + +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: + + Copyright (C) + 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 +. + + 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 +. diff --git a/LICENSE.MPL2 b/LICENSE.MPL2 new file mode 100644 index 00000000..14e2f777 --- /dev/null +++ b/LICENSE.MPL2 @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/README.md b/README.md index b30f4f78..3efa075d 100644 --- a/README.md +++ b/README.md @@ -59,4 +59,7 @@ and if developing and trying to run from this directory. You could use: PYTHONPATH=. python tests/test_basic.py ``` +## License +Like libigl, the wrapper source code is licensed under MPL2. Code included via +the copyleft and restricted sub-directories may have more restrictive licenses. diff --git a/classes/AABB.cpp b/classes/AABB.cpp new file mode 100644 index 00000000..29cff578 --- /dev/null +++ b/classes/AABB.cpp @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#include +#include + + +namespace py = pybind11; +template +void init_AABB(py::module_ &m) +{ + using AABB_f64_DIM = igl::AABB; + py::class_(m, (std::string("AABB_f64_")+std::to_string(DIM)).c_str() ) + .def(py::init([]() + { + std::unique_ptr self = std::make_unique(); + return self; + })) + .def("init",[](AABB_f64_DIM & self, const Eigen::MatrixXd & V, const Eigen::MatrixXi & F) + { + self.init(V,F); + }, + py::arg("V"), py::arg("F")) + .def("squared_distance",[]( + AABB_f64_DIM & self, + const Eigen::MatrixXd & V, + const Eigen::MatrixXi & F, + const Eigen::MatrixXd & P, + const bool return_index = false, + const bool return_closest_point = false) -> + std::variant > + { + Eigen::VectorXd sqrD; + Eigen::VectorXi I; + Eigen::MatrixXd C; + self.squared_distance(V,F,P,sqrD,I,C); + if(return_index && return_closest_point) + { + return std::list({npe::move(sqrD),npe::move(I),npe::move(C)}); + }else if(return_index) + { + return std::list({npe::move(sqrD),npe::move(I)}); + }else if(return_closest_point) + { + return std::list({npe::move(sqrD),npe::move(C)}); + }else + { + return npe::move(sqrD); + } + }, + py::arg("V"), + py::arg("F"), + py::arg("P"), + py::arg("return_index")=false, + py::arg("return_closest_point")=false + ) + ; +} + +template void init_AABB<2>(py::module_ &); +template void init_AABB<3>(py::module_ &); diff --git a/classes/classes.cpp b/classes/classes.cpp index 2348e4d3..1c194e7f 100644 --- a/classes/classes.cpp +++ b/classes/classes.cpp @@ -9,8 +9,15 @@ namespace py = pybind11; +// Forward declaration +template +void init_AABB(py::module_ &); + PYBIND11_MODULE(pyigl_classes, m) { + init_AABB<2>(m); + init_AABB<3>(m); + py::class_(m, "ARAP") .def(py::init([](Eigen::MatrixXd &v, Eigen::MatrixXi &f, int dim, Eigen::MatrixXi &b, const int energy_type, const bool with_dynamics, const double h, const double ym, const int max_iter) { diff --git a/cmake/PyiglDependencies.cmake b/cmake/PyiglDependencies.cmake index d01f663f..c644a1ac 100644 --- a/cmake/PyiglDependencies.cmake +++ b/cmake/PyiglDependencies.cmake @@ -19,7 +19,7 @@ include(FetchContent) FetchContent_Declare( libigl GIT_REPOSITORY https://github.com/libigl/libigl.git - GIT_TAG 78015d4da1c6799dfe15659ed35adfb3a5f23ffa + GIT_TAG 5779714a5bdd62e105a96edfa73d0d3755e33bc8 ) FetchContent_GetProperties(libigl) FetchContent_MakeAvailable(libigl) diff --git a/igl/__init__.py b/igl/__init__.py index a360820e..72d042f2 100644 --- a/igl/__init__.py +++ b/igl/__init__.py @@ -1,3 +1,10 @@ +# This file is part of libigl, a simple c++ geometry processing library. +# +# Copyright (C) 2023 Alec Jacobson +# +# This Source Code Form is subject to the terms of the Mozilla Public License +# v. 2.0. If a copy of the MPL was not distributed with this file, You can +# obtain one at http://mozilla.org/MPL/2.0/. from .pyigl import * from .helpers import * from .pyigl_classes import * diff --git a/igl/_version.py b/igl/_version.py index 8ef6ae96..bb8da2d8 100644 --- a/igl/_version.py +++ b/igl/_version.py @@ -1 +1,8 @@ -__version__ = "2.5.2dev" +# This file is part of libigl, a simple c++ geometry processing library. +# +# Copyright (C) 2023 Alec Jacobson +# +# This Source Code Form is subject to the terms of the Mozilla Public License +# v. 2.0. If a copy of the MPL was not distributed with this file, You can +# obtain one at http://mozilla.org/MPL/2.0/. +__version__ = "2.5.4dev" diff --git a/mkdocs.yml b/mkdocs.yml index 264740d7..348c91c9 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -10,14 +10,13 @@ remote_branch: 'gh-pages' theme: name: material favicon: 'favicon.ico' - logo: - icon: ' ' + icon: '' palette: primary: 'light blue' accent: 'blue' extra: social: - - type: 'github' + - icon: fontawesome/brands/github-alt link: 'https://github.com/libigl/libigl-python-bindings' markdown_extensions: - codehilite diff --git a/scripts/blender_igl_export.py b/scripts/blender_igl_export.py new file mode 100644 index 00000000..0c674e05 --- /dev/null +++ b/scripts/blender_igl_export.py @@ -0,0 +1,528 @@ +# Given a geometry, the armature and the root bone +# this script will export the .obj, .tgf and .dmat files +# for mesh, skeleton and skinning respectively. +# You can load this script directly from within blender +# and hit run + +import bpy +import io +import logging +import numpy as np +import struct + +from bpy_extras.io_utils import ( + axis_conversion, + ExportHelper +) + + +from collections import OrderedDict +from pathlib import Path + +# LOGGING SETUP +class ExportFileHandler(logging.FileHandler): + def __init__(self) -> None: + self._log_file = str(Path('~/Documents/blender_igl_export.log').expanduser()) + super().__init__( + self._log_file, + "w", + None, + False, + 'backslashreplace') + + self._n_errors = 0 + self._n_warns = 0 + + @property + def log_file(self): + return self._log_file + + @property + def num_warns(self): + return self._n_warns + + @property + def num_errors(self): + return self._n_errors + + def emit(self, record) -> None: + if record.levelno == logging.ERROR or record.levelno == logging.CRITICAL: + self._n_errors += 1 + elif record.levelno == logging.WARN or record.levelno == logging.WARNING: + self._n_warns += 1 + + return super().emit(record) + +log_handler = ExportFileHandler() +logging.basicConfig(handlers=[log_handler], level=logging.DEBUG, force=True) + +logger = logging.getLogger(__name__) + + +# GLOBAL CONSTANTS +IGL_AXIS_FORWARD = "-Z" +IGL_AXIS_UP = "Y" +EMPTY_ARRAY = np.array([]) + +GLOBAL_MATRIX = axis_conversion( + to_forward=IGL_AXIS_FORWARD, + to_up=IGL_AXIS_UP, +).to_4x4() + +def _convert_location_coordinate_system(location): + """ + Receives a location in Blender Coordinate System (Z Up, Y forward) + and converts it to a more traditional coordinate system (Y Up, -Z forward) + """ + transformed_location = GLOBAL_MATRIX @ location.to_4d() + + return transformed_location[:-1] + +def _convert_transform_coordinate_system(transform): + """ + Receives a transform as 4x4 affine matrix in Blender Coordinate System (Z Up, Y forward) + and converts it to a more traditional coordinate system (Y Up, -Z forward) + """ + transformed_location = GLOBAL_MATRIX @ transform + + return transformed_location + +def _export_matrix_as_dmat(file_name_without_ext, matrix): + """ + Given a numpy array as 2D matrix this function will write out + the matrix to a .dmat using the libigl specification. + """ + if len(matrix.shape) != 2: + logger.error(f"Dmat export expected 2D array. Got {matrix.shape}") + + with open(f"{file_name_without_ext}.dmat", "wb") as binary_writer: + binary_writer.write( + bytes(bytearray("0 0\n", encoding='ascii')) + ) + + binary_writer.write(bytes( + bytearray(f"{matrix.shape[1]} {matrix.shape[0]}\n", encoding='ascii') + )) + + flattened_matrix = matrix.flatten(order='F').tolist() + s = struct.pack('d'*len(flattened_matrix), *flattened_matrix) + binary_writer.write(s) + + +class IGLSkeleton: + def __init__(self): + # A bone is an unconnected entity + # Each bone will store a 4x4 transform relative to it's + # armature parent + self.bones = [] + # Will just store the xyz of the bone + self.head_bone_transforms = {} + + # A parent / joint is a connection of 2 bones. + # Each parent is a connection from parent index to child index + self.parents = OrderedDict() + + # Contains a mapping from blender bone name to IGL bone index + self.blender_bone_mapping = {} + + @property + def n_limbs(self): + return len(self.parents) + + @property + def n_bones(self): + return len(self.bones) + + @property + def bind_pose(self): + # Hold a numpy array for bind pose. + # We will not export the bind pose, but if animation + # is exported, this bind_pose can be used or exported + # independently + if self.n_limbs == 0: + logger.error("Requested bind pose when we have no limbs") + return EMPTY_ARRAY + + bind_pose_transforms = np.tile( + np.eye(4, dtype=np.float64), (self.n_limbs, 1, 1)) + + transform_idx = 0 + # NOTE: this ordering won't change, so safe to use this + for parent, _ in self.parents.items(): + bone_idx = parent[0] + + if bone_idx not in self.head_bone_transforms: + logger.error(f"{bone_idx} not in head bone transforms. How did it become a parent?") + return EMPTY_ARRAY + + # Does a very simple copy of the selected bone transforms + bind_pose_transforms[transform_idx, :, :] = self.head_bone_transforms[bone_idx] + transform_idx += 1 + + return bind_pose_transforms + + def add_bone(self, bone_name, location, transform=None): + if bone_name in self.blender_bone_mapping: + logger.error(f"{bone_name} already in IGL Skeleton") + return + + location = _convert_location_coordinate_system(location) + + self.bones.append(location) + self.blender_bone_mapping[bone_name] = len(self.bones) - 1 + + if transform is not None: + transform = np.array( + _convert_transform_coordinate_system(transform), dtype=np.float64) + + self.head_bone_transforms[len(self.bones) - 1] = transform + + logger.info(f"BONE {bone_name} added at {self.blender_bone_mapping[bone_name]}: {self.bones[-1]}") + + def add_parent(self, parent_bone_name, child_bone_name): + if parent_bone_name not in self.blender_bone_mapping: + logger.error(f"Parent {parent_bone_name} not in IGL Skeleton") + return + + if child_bone_name not in self.blender_bone_mapping: + logger.error(f"Child {child_bone_name} not in IGL Skeleton") + return + + edge_tuple = (self.blender_bone_mapping[parent_bone_name], self.blender_bone_mapping[child_bone_name]) + if edge_tuple in self.parents: + logger.error(f"{parent_bone_name}-{child_bone_name} pairing already in IGL Skeleton") + return + + reversed_edge_tuple = (self.blender_bone_mapping[child_bone_name], self.blender_bone_mapping[parent_bone_name]) + if reversed_edge_tuple in self.parents: + logger.warning(f"{parent_bone_name}-{child_bone_name} introduces a cylical bone structure which maybe unsupported") + + # Store the parent bone name, because this can be used to extract limb transform information + self.parents[edge_tuple] = parent_bone_name + + logger.info(f"LIMB {parent_bone_name}-{child_bone_name} added to IGL skeleton") + + def export(self, file_name_without_ext): + with open(f"{file_name_without_ext}.tgf", "w") as skeleton_writer: + for bone_idx, bone in enumerate(self.bones): + skeleton_writer.write( + f"{bone_idx + 1} {bone[0]} {bone[1]} {bone[2]}\n") + + skeleton_writer.write("#") + + for parent, _ in self.parents.items(): + # Adding 1 to the end of the write to indicate this is a bone edge. + skeleton_writer.write(f"\n{parent[0] + 1} {parent[1] + 1} 1") + + skeleton_writer.write("\n#") + + logger.info(f"SKELETON exported in {file_name_without_ext}.tgf") + + igl_bind_pose = self.bind_pose[:, :3, :] # J X 3 X 4 ... last row of affine matrix not needed + igl_bind_pose = igl_bind_pose.transpose((0, 2, 1)) # J X 4 X 3 ... igl standard + + # Save bind pose as npy + np.save(f"{file_name_without_ext}_bind_pose.npy", igl_bind_pose) + logger.info(f"BIND POSE {igl_bind_pose.shape} exported in {file_name_without_ext}_bind_pose.npy") + + # Save bind pose as dmat + # J*4 X 3 ... stack the transforms + bind_pose_flat = igl_bind_pose.reshape((-1, igl_bind_pose.shape[2])) + _export_matrix_as_dmat(f"{file_name_without_ext}_bind_pose.dmat", bind_pose_flat) + logger.info(f"BIND POSE {bind_pose_flat.shape} exported in {file_name_without_ext}_bind_pose.dmat") + + +class IGLDeformableMesh: + def __init__(self, geometry, igl_skeleton): + super().__init__() + self.geometry = geometry + self.skeleton = igl_skeleton + self.skinning = np.zeros((len(self.geometry.data.vertices), self.skeleton.n_limbs), dtype=np.float64) + + self._parse_skinning_data() + + def _parse_skinning_data(self): + for vert_idx in range(self.skinning.shape[0]): + for vertex_group in self.geometry.vertex_groups: + if vertex_group.name not in self.skeleton.blender_bone_mapping: + logger.error(f"{vertex_group.name} is a vertex group but the bone doesn't exist") + return + + bone_idx = self.skeleton.blender_bone_mapping[vertex_group.name] + try: + self.skinning[vert_idx, bone_idx] = vertex_group.weight(vert_idx) + except RuntimeError: + self.skinning[vert_idx, bone_idx] = 0.0 + + logger.info( + f"Constructed {self.skinning.shape} skinning matrix. Max: {self.skinning.max()}, Min: {self.skinning.min(0)}") + + def export(self, file_name_without_ext, export_mesh=True, export_weights=True): + if export_weights: + self._export_weights(file_name_without_ext) + logger.info("Skinning Matrix successfully exported") + + if export_mesh: + self._export_obj(file_name_without_ext) + if not self._validate_obj(file_name_without_ext): + logger.error("Obj Validation Failed") + else: + logger.info("OBJ successfully exported") + + + def _export_weights(self, file_name_without_ext): + _export_matrix_as_dmat(file_name_without_ext, self.skinning) + + def _export_obj(self, file_name_without_ext): + # Always Export from Frame 0 + current_frame = bpy.context.scene.frame_current + bpy.context.scene.frame_set(0) + + bpy.ops.export_scene.obj( + filepath=f"{file_name_without_ext}.obj", + check_existing=False, + filter_glob='*.obj;*.mtl', + use_selection=False, + use_animation=False, + use_mesh_modifiers=True, + use_edges=False, + use_smooth_groups=False, + use_smooth_groups_bitflags=False, + use_normals=True, + use_uvs=True, + use_materials=True, + use_triangles=False, + use_nurbs=False, + use_vertex_groups=False, + use_blen_objects=True, + group_by_object=False, + group_by_material=True, + keep_vertex_order=True, + global_scale=1.0, + path_mode='AUTO', + axis_forward=IGL_AXIS_FORWARD, + axis_up=IGL_AXIS_UP + ) + + # Reset the frame + bpy.context.scene.frame_set(current_frame) + + def _validate_obj(self, file_name_without_ext): + is_valid = True + with open(f"{file_name_without_ext}.obj", "r") as obj_reader: + all_lines = obj_reader.readlines() + for idx, line in enumerate(all_lines): + split = line.split(" ") + if split[0] == 'f': + # len should be 4 including 4 + if len(split) != 4: + logger.error(f"Line {idx+1} has illegal face definition. Triangulate your mesh") + is_valid = False + + return is_valid + +class IGLAnimation: + def __init__(self, igl_skeleton, parent_armature, start_frame, end_frame): + self.skeleton = igl_skeleton + self.armature = parent_armature + self.action = parent_armature.animation_data.action + + end_key_frame = 1 + for fcu in self.action.fcurves: + for idx, keyframe in enumerate(fcu.keyframe_points): + end_key_frame = max(end_key_frame, keyframe.co[0]) + + self.start_frame = int(min(start_frame, end_key_frame)) # Can't start beyond the last key frame + self.end_frame = int(min(end_frame, end_key_frame)) # Can't end beyond the last key frame + + logger.info(f"Ready to Export Animation frames [{self.start_frame}, {self.end_frame}]") + + def _export_npy(self, filepath, animation): + np.save(f"{filepath}_animation.npy", animation) + logger.info( + f"ANIMATION ({animation.shape}) exported as npy") + + def _export_dmat(self, filepath, animation): + # Frames X J*4*3 + animation_flat = animation.reshape((animation.shape[0], -1)) + animation_flat = animation_flat.transpose() # J*4*3 X Frames + + _export_matrix_as_dmat(f"{filepath}_animation", animation_flat) + + logger.info( + (f"ANIMATION [{animation_flat.shape} column ordered from {animation.shape}] " + "exported as dmat")) + + def _get_bind_pose_relative_animation(self, bind_pose, animation): + # Given a bind pose and a list of animation frames + # where each frame has world transforms of the bones + # this function will apply the inverse of the bind pose to get + # relative frames. + inverse_bind_pose = np.linalg.inv(bind_pose) + relative_animation = [frame @ inverse_bind_pose for frame in animation] + + return relative_animation + + + def export(self, filepath): + # Store the current frame in UI to restore after export + current_frame = bpy.context.scene.frame_current + + animation = [] + bpy.context.window_manager.progress_begin(0, self.end_frame + 1) + bpy.context.window_manager.progress_update(0) + for frame in range(self.start_frame, self.end_frame + 1): + bpy.context.scene.frame_set(frame) + + pose = [] + # NOTE: This ordering will be consistent with bind_pose because parents + # is an OrderedDict + for _, parent_name in self.skeleton.parents.items(): + bone = self.armature.pose.bones[parent_name] + bone_transform = _convert_transform_coordinate_system(bone.matrix) + pose.append(bone_transform) + + animation.append(pose) + bpy.context.window_manager.progress_update(frame) + + # Restore UI active frame + bpy.context.scene.frame_set(current_frame) + + # Make IGL ready bind pose + bind_pose = self.skeleton.bind_pose + + # Make IGL ready animation + igl_animation = np.array(self._get_bind_pose_relative_animation(bind_pose, animation)) + igl_animation = igl_animation[:, :, :3, :] # Frames X J X 3 X 4 ... last row of affine matrix not needed + igl_animation = igl_animation.transpose((0, 1, 3, 2)) # Frames X J X 4 X 3 ... igl standard + + self._export_npy(filepath, igl_animation) + self._export_dmat(filepath, igl_animation) + + +# FILE BROWSER SETUP +class IGLExportHelper(bpy.types.Operator, ExportHelper): + bl_idname = 'igl.export_helper' + bl_label = 'Export' + + filename_ext = '' + + export_skeleton: bpy.props.BoolProperty( + name="Export Skeleton", + description="Exports a tgf with bones and parent relationships", + default=True + ) + + export_skinning: bpy.props.BoolProperty( + name="Export Skinning", + description="Exports a dmat with a dense matrix of vertex influence weights per bone (#V x #J)", + default=True + ) + + export_mesh: bpy.props.BoolProperty( + name="Export Mesh", + description="Exports a obj containing the mesh that has been skinned", + default=True + ) + + export_animation: bpy.props.BoolProperty( + name="Export Animation", + description="Exports a npy or dmat with bind pose and animation data", + default=True + ) + + anim_start: bpy.props.IntProperty( + name="Animation Start Frame", + description="Starting animation frame for export", + default=1, min=1, max=300000 + ) + + anim_end: bpy.props.IntProperty( + name="Animation End Frame", + description="Ending animation frame for export", + default=250, min=0, max=300000 + ) + + + def _begin_export(self, context, file_path): + if len(bpy.context.selected_objects) != 1: + logger.error("No support for 0 or multiple objects selected. Select the object at the highest level") + return + + parent = bpy.context.selected_objects[0] + logger.info(f"Exporting a Skinned Mesh @ {parent.name}") + + if len(parent.children) != 1: + logger.error("We support skinning of a single geometry only") + return + + if parent.name not in bpy.data.armatures: + logger.error(f"Expected to have {parent.name} as the corresponding armature name as well") + return + + geometry = parent.children[0] + armature = bpy.data.armatures[parent.name] + + logger.info(f"Processing Armature with {len(armature.bones)} bones") + root_bone = "root" + if root_bone not in armature.bones: + logger.error(f"Please mark the highest level node as {root_bone}") + return + + bones_to_process = [armature. + bones[root_bone]] + igl_skeleton = IGLSkeleton() + + while len(bones_to_process) > 0: + bone = bones_to_process.pop() + igl_skeleton.add_bone(bone.name, bone.head_local, bone.matrix_local) + if bone.parent is not None: + # At this point the parent should have already been added to IGL Skeleton + igl_skeleton.add_parent(bone.parent.name, bone.name) + + if len(bone.children) == 0: + tail_bone_name = f"{bone.name}_tail" + igl_skeleton.add_bone(tail_bone_name, bone.tail_local) + igl_skeleton.add_parent(bone.name, tail_bone_name) + else: + for child in bone.children: + bones_to_process.append(child) + + deformable_mesh = IGLDeformableMesh(geometry, igl_skeleton) + + if self.export_skeleton: + igl_skeleton.export(file_path) + + if self.export_mesh or self.export_skinning: + deformable_mesh.export(file_path, self.export_mesh, self.export_skinning) + + if self.export_animation: + if parent.animation_data is None: + logger.error("Requested to export animation but no animation data found") + else: + animation = IGLAnimation(igl_skeleton, parent, self.anim_start, self.anim_end) + animation.export(file_path) + + self.report({'INFO'}, ( + f"Finished Export to {file_path}." + f" Errors: {log_handler.num_errors}, Warnings: {log_handler.num_warns}" + )) + self.report({'INFO'}, f"Log dumped to {log_handler.log_file}") + + def _get_valid_asset_path(self, filepath): + if len(filepath.split('.')) > 1: + # Remove any extension + return filepath.split('.')[0] + elif filepath[-1] == "/": + # Use a temporary name if a folder was selected. + return filepath + "tmp" + return filepath + + def execute(self, context): + self._begin_export(context, self._get_valid_asset_path(self.filepath)) + return {'FINISHED'} + +if __name__ == "__main__": + bpy.utils.register_class(IGLExportHelper) + bpy.ops.igl.export_helper('INVOKE_DEFAULT') + \ No newline at end of file diff --git a/setup.py b/setup.py index 8b2884da..6799e6e2 100644 --- a/setup.py +++ b/setup.py @@ -111,6 +111,16 @@ def build_extension(self, ext): os.makedirs(self.build_temp) subprocess.check_call(['cmake', ext.sourcedir] + cmake_args, cwd=self.build_temp, env=env) + # print build_args + print("********************************************************************") + print("********************************************************************") + print("********************************************************************") + print("********************************************************************") + print("build_args:", build_args) + print("********************************************************************") + print("********************************************************************") + print("********************************************************************") + print("********************************************************************") subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp) print() # Add an empty line for cleaner output diff --git a/src/active_set.cpp b/src/active_set.cpp index 2b6964f2..cb61be07 100644 --- a/src/active_set.cpp +++ b/src/active_set.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/adjacency_list.cpp b/src/adjacency_list.cpp index af77d123..73e1aa30 100644 --- a/src/adjacency_list.cpp +++ b/src/adjacency_list.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/adjacency_matrix.cpp b/src/adjacency_matrix.cpp index 8ddd74c5..e7a5150e 100644 --- a/src/adjacency_matrix.cpp +++ b/src/adjacency_matrix.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/all_pairs_distances.cpp b/src/all_pairs_distances.cpp index 4f812060..86efe66d 100644 --- a/src/all_pairs_distances.cpp +++ b/src/all_pairs_distances.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/ambient_occlusion.cpp b/src/ambient_occlusion.cpp index e80e5f23..e975c796 100644 --- a/src/ambient_occlusion.cpp +++ b/src/ambient_occlusion.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __missing miss the rest two functions with AABB and shoot_ray. __example #include diff --git a/src/arap_linear_block.cpp b/src/arap_linear_block.cpp index e33a9936..bca93a5c 100644 --- a/src/arap_linear_block.cpp +++ b/src/arap_linear_block.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/arap_rhs.cpp b/src/arap_rhs.cpp index 2482c66c..85298a6a 100644 --- a/src/arap_rhs.cpp +++ b/src/arap_rhs.cpp @@ -1,10 +1,17 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include #include const char* ds_arap_rhs = R"igl_Qu8mg5v7( -Guild right-hand side constructor of global poisson solve for various ARAP energies +Build right-hand side constructor of global poisson solve for various ARAP energies Inputs: Outputs: diff --git a/src/average_onto_faces.cpp b/src/average_onto_faces.cpp index f56328db..f8f6c76a 100644 --- a/src/average_onto_faces.cpp +++ b/src/average_onto_faces.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/average_onto_vertices.cpp b/src/average_onto_vertices.cpp index 5c380856..b9795fa9 100644 --- a/src/average_onto_vertices.cpp +++ b/src/average_onto_vertices.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/avg_edge_length.cpp b/src/avg_edge_length.cpp index fd8e406e..96cf0546 100644 --- a/src/avg_edge_length.cpp +++ b/src/avg_edge_length.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/barycenter.cpp b/src/barycenter.cpp index 323a48a3..45f24425 100644 --- a/src/barycenter.cpp +++ b/src/barycenter.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/barycentric_coordinates.cpp b/src/barycentric_coordinates.cpp index 92d4726d..1a8ccf0e 100644 --- a/src/barycentric_coordinates.cpp +++ b/src/barycentric_coordinates.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/bfs.cpp b/src/bfs.cpp index af894128..954e9d82 100644 --- a/src/bfs.cpp +++ b/src/bfs.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/bfs_orient.cpp b/src/bfs_orient.cpp index 0f1d4f92..02a2c65c 100644 --- a/src/bfs_orient.cpp +++ b/src/bfs_orient.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/biharmonic_coordinates.cpp b/src/biharmonic_coordinates.cpp index 4f20ddc0..5cab20c8 100644 --- a/src/biharmonic_coordinates.cpp +++ b/src/biharmonic_coordinates.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/bijective_composite_harmonic_mapping.cpp b/src/bijective_composite_harmonic_mapping.cpp index f01686ac..235a14e3 100644 --- a/src/bijective_composite_harmonic_mapping.cpp +++ b/src/bijective_composite_harmonic_mapping.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/blue_noise.cpp b/src/blue_noise.cpp index c6fff50c..3e3629d2 100644 --- a/src/blue_noise.cpp +++ b/src/blue_noise.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Peter Kulits +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example #include #include diff --git a/src/bone_parents.cpp b/src/bone_parents.cpp index 75934283..977cb639 100644 --- a/src/bone_parents.cpp +++ b/src/bone_parents.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/boundary_conditions.cpp b/src/boundary_conditions.cpp index 1696de38..35d88e06 100644 --- a/src/boundary_conditions.cpp +++ b/src/boundary_conditions.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include @@ -23,6 +30,7 @@ C #C by dim list of handle positions P #P by 1 list of point handle indices into C BE #BE by 2 list of bone edge indices into C CE #CE by 2 list of cage edge indices into *P* +CF #CF by 3 list of cage edge indices into *P* Returns ------- @@ -59,6 +67,7 @@ npe_arg(c, npe_matches(v)) npe_arg(p, npe_matches(ele)) npe_arg(be, npe_matches(ele)) npe_arg(ce, npe_matches(ele)) +npe_arg(cf, npe_matches(ele)) npe_begin_code() assert_valid_tet_or_tri_mesh(v, ele); @@ -74,6 +83,10 @@ npe_begin_code() { assert_cols_equals(ce, 2, "ce"); } + if(cf.size() > 0) + { + assert_cols_equals(cf, 3, "cf"); + } //TODO: remove __copy Eigen::MatrixXd v_copy = v.template cast(); @@ -86,9 +99,12 @@ npe_begin_code() Eigen::MatrixXi ce_copy; if (ce.size() > 0) ce_copy = ce.template cast(); + Eigen::MatrixXi cf_copy; + if (cf.size() > 0) + cf_copy = cf.template cast(); Eigen::VectorXi b_copy; Eigen::MatrixXd bc_copy; - bool success = igl::boundary_conditions(v_copy, ele_copy, c_copy, p_copy, be_copy, ce_copy, b_copy, bc_copy); + bool success = igl::boundary_conditions(v_copy, ele_copy, c_copy, p_copy, be_copy, ce_copy, cf_copy, b_copy, bc_copy); EigenDenseLike b = b_copy.template cast(); EigenDenseLike bc = bc_copy.template cast(); return std::make_tuple(success, npe::move(b), npe::move(bc)); diff --git a/src/boundary_facets.cpp b/src/boundary_facets.cpp index f882de32..1721363c 100644 --- a/src/boundary_facets.cpp +++ b/src/boundary_facets.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/boundary_loop.cpp b/src/boundary_loop.cpp index 92fa2fe2..cb90f359 100644 --- a/src/boundary_loop.cpp +++ b/src/boundary_loop.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/bounding_box.cpp b/src/bounding_box.cpp index 3ff5f456..df8eff23 100644 --- a/src/bounding_box.cpp +++ b/src/bounding_box.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/bounding_box_diagonal.cpp b/src/bounding_box_diagonal.cpp index 09fde4e9..2962de69 100644 --- a/src/bounding_box_diagonal.cpp +++ b/src/bounding_box_diagonal.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include diff --git a/src/circulation.cpp b/src/circulation.cpp index 471a08a9..c87fa70a 100644 --- a/src/circulation.cpp +++ b/src/circulation.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example //difficult to test diff --git a/src/circumradius.cpp b/src/circumradius.cpp index db94679f..73eecb7a 100644 --- a/src/circumradius.cpp +++ b/src/circumradius.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/collapse_small_triangles.cpp b/src/collapse_small_triangles.cpp index e4f1909a..3740dd92 100644 --- a/src/collapse_small_triangles.cpp +++ b/src/collapse_small_triangles.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include diff --git a/src/comb_cross_field.cpp b/src/comb_cross_field.cpp index 5908d5e2..911d45e1 100644 --- a/src/comb_cross_field.cpp +++ b/src/comb_cross_field.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/comb_frame_field.cpp b/src/comb_frame_field.cpp index b7c8748b..e80eda90 100644 --- a/src/comb_frame_field.cpp +++ b/src/comb_frame_field.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/comb_line_field.cpp b/src/comb_line_field.cpp index a6ec9a58..bda90564 100644 --- a/src/comb_line_field.cpp +++ b/src/comb_line_field.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/compute_frame_field_bisectors.cpp b/src/compute_frame_field_bisectors.cpp index 16089e52..8207a6bc 100644 --- a/src/compute_frame_field_bisectors.cpp +++ b/src/compute_frame_field_bisectors.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/connect_boundary_to_infinity.cpp b/src/connect_boundary_to_infinity.cpp index 100f8fa5..5166d978 100644 --- a/src/connect_boundary_to_infinity.cpp +++ b/src/connect_boundary_to_infinity.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include diff --git a/src/connected_components.cpp b/src/connected_components.cpp index e14e341e..abde7344 100644 --- a/src/connected_components.cpp +++ b/src/connected_components.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/copyleft/cgal/convex_hull.cpp b/src/copyleft/cgal/convex_hull.cpp index 8e225e95..e2127735 100644 --- a/src/copyleft/cgal/convex_hull.cpp +++ b/src/copyleft/cgal/convex_hull.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Alec Jacobson +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include @@ -22,10 +29,7 @@ npe_arg(v, dense_float, dense_double) npe_begin_code() EigenDenseInt g; - // when https://github.com/libigl/libigl/pull/1989 is merged this copy should - // be removed - Eigen::MatrixXd v_copy = v.template cast(); - igl::copyleft::cgal::convex_hull(v_copy, g); + igl::copyleft::cgal::convex_hull(v, g); return npe::move(g); npe_end_code() diff --git a/src/copyleft/cgal/intersect_other.cpp b/src/copyleft/cgal/intersect_other.cpp index 02d2a857..b391e657 100644 --- a/src/copyleft/cgal/intersect_other.cpp +++ b/src/copyleft/cgal/intersect_other.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Alec Jacobson +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/copyleft/cgal/mesh_boolean.cpp b/src/copyleft/cgal/mesh_boolean.cpp index 910fafaf..342de527 100644 --- a/src/copyleft/cgal/mesh_boolean.cpp +++ b/src/copyleft/cgal/mesh_boolean.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Alec Jacobson +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/copyleft/cgal/remesh_self_intersections.cpp b/src/copyleft/cgal/remesh_self_intersections.cpp index 9c1625ad..ce397c1d 100644 --- a/src/copyleft/cgal/remesh_self_intersections.cpp +++ b/src/copyleft/cgal/remesh_self_intersections.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Alec Jacobson +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/cotmatrix.cpp b/src/cotmatrix.cpp index 189f6dd1..142f9b1a 100644 --- a/src/cotmatrix.cpp +++ b/src/cotmatrix.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/cotmatrix_entries.cpp b/src/cotmatrix_entries.cpp index 241241a9..ba2ebe74 100644 --- a/src/cotmatrix_entries.cpp +++ b/src/cotmatrix_entries.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/cotmatrix_intrinsic.cpp b/src/cotmatrix_intrinsic.cpp index 0ed923c4..7d0d4149 100644 --- a/src/cotmatrix_intrinsic.cpp +++ b/src/cotmatrix_intrinsic.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/cross_field_missmatch.cpp b/src/cross_field_missmatch.cpp index 5a2a0980..dc98dd75 100644 --- a/src/cross_field_missmatch.cpp +++ b/src/cross_field_missmatch.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/crouzeix_raviart_cotmatrix.cpp b/src/crouzeix_raviart_cotmatrix.cpp index 5246d27c..72f08659 100644 --- a/src/crouzeix_raviart_cotmatrix.cpp +++ b/src/crouzeix_raviart_cotmatrix.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/crouzeix_raviart_massmatrix.cpp b/src/crouzeix_raviart_massmatrix.cpp index 2e948985..bcb6d4e8 100644 --- a/src/crouzeix_raviart_massmatrix.cpp +++ b/src/crouzeix_raviart_massmatrix.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // static assertion fail: YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY #include diff --git a/src/cut_mesh.cpp b/src/cut_mesh.cpp index a4367f05..d83234ca 100644 --- a/src/cut_mesh.cpp +++ b/src/cut_mesh.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Francis Williams +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/cut_mesh_from_singularities.cpp b/src/cut_mesh_from_singularities.cpp index 0cc5b979..a4dba386 100644 --- a/src/cut_mesh_from_singularities.cpp +++ b/src/cut_mesh_from_singularities.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Francis Williams +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/cut_to_disk.cpp b/src/cut_to_disk.cpp index 9a44052f..ef817b9f 100644 --- a/src/cut_to_disk.cpp +++ b/src/cut_to_disk.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/cylinder.cpp b/src/cylinder.cpp index bcca9330..e8d551e3 100644 --- a/src/cylinder.cpp +++ b/src/cylinder.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include diff --git a/src/decimate.cpp b/src/decimate.cpp index bc75955a..6cd526f4 100644 --- a/src/decimate.cpp +++ b/src/decimate.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __miss 4 functions #include diff --git a/src/deform_skeleton.cpp b/src/deform_skeleton.cpp index 4a9d0f0d..4ff00893 100644 --- a/src/deform_skeleton.cpp +++ b/src/deform_skeleton.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/dihedral_angles.cpp b/src/dihedral_angles.cpp index 3aa4dd70..31e2ef80 100644 --- a/src/dihedral_angles.cpp +++ b/src/dihedral_angles.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/direct_delta_mush.cpp b/src/direct_delta_mush.cpp index 4b30614b..073431b1 100644 --- a/src/direct_delta_mush.cpp +++ b/src/direct_delta_mush.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Kishore Venkateshan +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/directed_edge_orientations.cpp b/src/directed_edge_orientations.cpp index 4be546c8..adf6a343 100644 --- a/src/directed_edge_orientations.cpp +++ b/src/directed_edge_orientations.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/directed_edge_parents.cpp b/src/directed_edge_parents.cpp index 08fb306b..3f4e4624 100644 --- a/src/directed_edge_parents.cpp +++ b/src/directed_edge_parents.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/doublearea.cpp b/src/doublearea.cpp index edac246f..ba8ea116 100644 --- a/src/doublearea.cpp +++ b/src/doublearea.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/dqs.cpp b/src/dqs.cpp index 1eff2caf..206df46b 100644 --- a/src/dqs.cpp +++ b/src/dqs.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/ears.cpp b/src/ears.cpp index bff4a3a9..c53ba80b 100644 --- a/src/ears.cpp +++ b/src/ears.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/edge_collapse_is_valid.cpp b/src/edge_collapse_is_valid.cpp index 7b939362..77e53907 100644 --- a/src/edge_collapse_is_valid.cpp +++ b/src/edge_collapse_is_valid.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/edge_flaps.cpp b/src/edge_flaps.cpp index e01df6e0..3324b1f6 100644 --- a/src/edge_flaps.cpp +++ b/src/edge_flaps.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/edge_lengths.cpp b/src/edge_lengths.cpp index 1429fb8f..1bc775a2 100644 --- a/src/edge_lengths.cpp +++ b/src/edge_lengths.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/edge_topology.cpp b/src/edge_topology.cpp index 0a1b6f76..721fab90 100644 --- a/src/edge_topology.cpp +++ b/src/edge_topology.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/edges.cpp b/src/edges.cpp index 853abbb4..c0a345c8 100644 --- a/src/edges.cpp +++ b/src/edges.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/edges_to_path.cpp b/src/edges_to_path.cpp index e131b275..0dcf8960 100644 --- a/src/edges_to_path.cpp +++ b/src/edges_to_path.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/euler_characteristic.cpp b/src/euler_characteristic.cpp index e1fcf111..e1e53db4 100644 --- a/src/euler_characteristic.cpp +++ b/src/euler_characteristic.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include diff --git a/src/exact_geodesic.cpp b/src/exact_geodesic.cpp index 031bb655..f12fce8b 100644 --- a/src/exact_geodesic.cpp +++ b/src/exact_geodesic.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/exterior_edges.cpp b/src/exterior_edges.cpp index 21aed1f6..c14c4522 100644 --- a/src/exterior_edges.cpp +++ b/src/exterior_edges.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // need assertion for a.rows = b.rows-1 // __copy #include diff --git a/src/extract_manifold_patches.cpp b/src/extract_manifold_patches.cpp index 13976fa0..fb308ed0 100644 --- a/src/extract_manifold_patches.cpp +++ b/src/extract_manifold_patches.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/extract_non_manifold_edge_curves.cpp b/src/extract_non_manifold_edge_curves.cpp index b685f0c4..26d0f708 100644 --- a/src/extract_non_manifold_edge_curves.cpp +++ b/src/extract_non_manifold_edge_curves.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/face_occurrences.cpp b/src/face_occurrences.cpp index 4911675b..5a0a89c0 100644 --- a/src/face_occurrences.cpp +++ b/src/face_occurrences.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/faces_first.cpp b/src/faces_first.cpp index 469e70b1..dbed224b 100644 --- a/src/faces_first.cpp +++ b/src/faces_first.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/facet_components.cpp b/src/facet_components.cpp index 9cfa753b..b12d6432 100644 --- a/src/facet_components.cpp +++ b/src/facet_components.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Nico +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/false_barycentric_subdivision.cpp b/src/false_barycentric_subdivision.cpp index 0a9a1048..74146eb5 100644 --- a/src/false_barycentric_subdivision.cpp +++ b/src/false_barycentric_subdivision.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/fast_winding_number.cpp b/src/fast_winding_number.cpp index 3504e124..3565986a 100644 --- a/src/fast_winding_number.cpp +++ b/src/fast_winding_number.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/find_cross_field_singularities.cpp b/src/find_cross_field_singularities.cpp index 9a5d4b4e..b4740c81 100644 --- a/src/find_cross_field_singularities.cpp +++ b/src/find_cross_field_singularities.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/fit_cubic_bezier.cpp b/src/fit_cubic_bezier.cpp index c68f7c99..a6e4ffe9 100644 --- a/src/fit_cubic_bezier.cpp +++ b/src/fit_cubic_bezier.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Alec Jacobson +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/fit_plane.cpp b/src/fit_plane.cpp index c8489c6a..a8910fc1 100644 --- a/src/fit_plane.cpp +++ b/src/fit_plane.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include diff --git a/src/flip_avoiding_line_search.cpp b/src/flip_avoiding_line_search.cpp index 3b17fef9..f66a13cc 100644 --- a/src/flip_avoiding_line_search.cpp +++ b/src/flip_avoiding_line_search.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include diff --git a/src/flip_edge.cpp b/src/flip_edge.cpp index 2f0676dc..9d44b610 100644 --- a/src/flip_edge.cpp +++ b/src/flip_edge.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Soboleva Natalia +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/flipped_triangles.cpp b/src/flipped_triangles.cpp index ac57e2ce..80c71d2c 100644 --- a/src/flipped_triangles.cpp +++ b/src/flipped_triangles.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/forward_kinematics.cpp b/src/forward_kinematics.cpp index 9431a9eb..916f170b 100644 --- a/src/forward_kinematics.cpp +++ b/src/forward_kinematics.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/gaussian_curvature.cpp b/src/gaussian_curvature.cpp index 9905a4c6..9685a308 100644 --- a/src/gaussian_curvature.cpp +++ b/src/gaussian_curvature.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/grad.cpp b/src/grad.cpp index 2cc33a9c..0d19258b 100644 --- a/src/grad.cpp +++ b/src/grad.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/grad_intrinsic.cpp b/src/grad_intrinsic.cpp index 2a20ff5f..42b94af7 100644 --- a/src/grad_intrinsic.cpp +++ b/src/grad_intrinsic.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/harmonic.cpp b/src/harmonic.cpp index a410257c..9e5dc744 100644 --- a/src/harmonic.cpp +++ b/src/harmonic.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/hausdorff.cpp b/src/hausdorff.cpp index 26e908d0..5f7da201 100644 --- a/src/hausdorff.cpp +++ b/src/hausdorff.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/heat_geodesic.cpp b/src/heat_geodesic.cpp index e6c2726a..418d95f4 100644 --- a/src/heat_geodesic.cpp +++ b/src/heat_geodesic.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/hessian.cpp b/src/hessian.cpp index 999c2ced..ac8d1933 100644 --- a/src/hessian.cpp +++ b/src/hessian.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/hessian_energy.cpp b/src/hessian_energy.cpp index daf26fa3..b9c0a5b7 100644 --- a/src/hessian_energy.cpp +++ b/src/hessian_energy.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // might be sparse matrix problem #include diff --git a/src/in_element.cpp b/src/in_element.cpp new file mode 100644 index 00000000..78a79f80 --- /dev/null +++ b/src/in_element.cpp @@ -0,0 +1,61 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Alec Jacobson +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. +#include +#include +#include +#include +#include + +using AABB_f64_3 = igl::AABB; +const char* ds_in_element = R"igl_Qu8mg5v7( +Determine whether each point in a list of points is in the elements of a mesh. + +Parameters: +------ +V : #V by dim list of mesh vertex positions. +Ele : #Ele by dim+1 list of mesh indices into #V. +Q : #Q by dim list of query point positions +aabb : axis-aligned bounding box tree object (see AABB.h) + +Returns: +------- +I : #Q list of indices into Ele of first containing element (-1 means no +containing element) +)igl_Qu8mg5v7"; +npe_function(in_element_3) +npe_doc( ds_in_element) +npe_arg(V, Eigen::MatrixXd) +npe_arg(Ele, Eigen::MatrixXi) +npe_arg(Q, Eigen::MatrixXd) +npe_arg(aabb, AABB_f64_3) +npe_begin_code() + + Eigen::VectorXi I; + igl::in_element(V,Ele,Q,aabb,I); + return npe::move(I); + +npe_end_code() + + +using AABB_f64_2 = igl::AABB; +npe_function(in_element_2) +npe_doc( ds_in_element) +npe_arg(V, Eigen::MatrixXd) +npe_arg(Ele, Eigen::MatrixXi) +npe_arg(Q, Eigen::MatrixXd) +npe_arg(aabb, AABB_f64_2) +npe_begin_code() + + Eigen::VectorXi I; + igl::in_element(V,Ele,Q,aabb,I); + return npe::move(I); + +npe_end_code() + + + diff --git a/src/inradius.cpp b/src/inradius.cpp index 1b3f23c3..89ef6d3c 100644 --- a/src/inradius.cpp +++ b/src/inradius.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/internal_angles.cpp b/src/internal_angles.cpp index 0f9ca995..ac8d6bfe 100644 --- a/src/internal_angles.cpp +++ b/src/internal_angles.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/intrinsic_delaunay_cotmatrix.cpp b/src/intrinsic_delaunay_cotmatrix.cpp index 3a0cf7fd..d04627ab 100644 --- a/src/intrinsic_delaunay_cotmatrix.cpp +++ b/src/intrinsic_delaunay_cotmatrix.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/intrinsic_delaunay_triangulation.cpp b/src/intrinsic_delaunay_triangulation.cpp index 8e938a01..37bb4e4f 100644 --- a/src/intrinsic_delaunay_triangulation.cpp +++ b/src/intrinsic_delaunay_triangulation.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/is_border_vertex.cpp b/src/is_border_vertex.cpp index 4de6c859..875108e8 100644 --- a/src/is_border_vertex.cpp +++ b/src/is_border_vertex.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/is_delaunay.cpp b/src/is_delaunay.cpp index 9456f60a..559b528f 100644 --- a/src/is_delaunay.cpp +++ b/src/is_delaunay.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/is_edge_manifold.cpp b/src/is_edge_manifold.cpp index 92d4f2c3..d7bdc8f2 100644 --- a/src/is_edge_manifold.cpp +++ b/src/is_edge_manifold.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example, decide if to remove the first function #include diff --git a/src/is_intrinsic_delaunay.cpp b/src/is_intrinsic_delaunay.cpp index 20522ddf..559f80da 100644 --- a/src/is_intrinsic_delaunay.cpp +++ b/src/is_intrinsic_delaunay.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/is_irregular_vertex.cpp b/src/is_irregular_vertex.cpp index 3ed0ac84..91fd8895 100644 --- a/src/is_irregular_vertex.cpp +++ b/src/is_irregular_vertex.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include @@ -9,7 +16,6 @@ Determine if a vertex is irregular, i.e. it has more than 6 (triangles) or 4 (qu Parameters ---------- -v : #v by dim array of vertex positions f : #f by 3[4] array of triangle[quads] indices Returns @@ -32,12 +38,10 @@ Examples npe_function(is_irregular_vertex) npe_doc(ds_is_irregular_vertex) -npe_arg(v, dense_float, dense_double) -npe_arg(f, dense_int, dense_long) +npe_arg(f, dense_int, dense_long ) npe_begin_code() - assert_valid_tet_or_tri_mesh_23d(v, f); - const std::vector res = igl::is_irregular_vertex(v, f); + const std::vector res = igl::is_irregular_vertex(f); return res; npe_end_code() diff --git a/src/isolines.cpp b/src/isolines.cpp index 4c28d567..d771ca58 100644 --- a/src/isolines.cpp +++ b/src/isolines.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example #include @@ -10,15 +17,16 @@ const char *ds_isolines = R"igl_Qu8mg5v7( Parameters ---------- - V #V by dim list of mesh vertex positions - F #F by 3 list of mesh faces (must be triangles) - z #V by 1 list of function values evaluated at vertices - n the number of desired isolines + V #V by dim list of mesh vertex positions + F #F by 3 list of mesh triangle indices into V + S #S by 1 list of per-vertex scalar values + vals #vals by 1 list of values to compute isolines for Returns ------- - isoV #isoV by dim list of isoline vertex positions - isoE #isoE by 2 list of isoline edge positions + iV #iV by dim list of isoline vertex positions + iE #iE by 2 list of edge indices into iV + I #iE by 1 list of indices into vals indicating which value See also -------- @@ -37,21 +45,23 @@ Examples npe_function(isolines) npe_doc(ds_isolines) -npe_arg(v, dense_float, dense_double) -npe_arg(f, dense_int, dense_long) -npe_arg(z, dense_float, dense_double) -npe_arg(n, int) +npe_arg(V, dense_float, dense_double) +npe_arg(F, dense_int, dense_long ) +npe_arg(S, npe_matches(V)) +npe_arg(vals, npe_matches(S)) npe_begin_code() - assert_valid_23d_tri_mesh(v, f); - assert_rows_match(v, z, "v", "z"); - assert_cols_equals(z, 1, "z"); - EigenDenseLike iso_v; - EigenDenseLike iso_e; - igl::isolines(v, f, z, n, iso_v, iso_e); - return std::make_tuple(npe::move(iso_v), npe::move(iso_e)); + assert_valid_23d_tri_mesh(V, F); + assert_rows_match(V, S, "V", "S"); + assert_cols_equals(S, 1, "S"); + EigenDenseLike iV; + EigenDenseLike iE; + Eigen::Matrix I; + Eigen::Matrix vals_copy = vals; + igl::isolines(V, F, S.col(0), vals_copy, iV, iE, I); + return std::make_tuple(npe::move(iV), npe::move(iE), npe::move(I)); npe_end_code() diff --git a/src/iterative_closest_point.cpp b/src/iterative_closest_point.cpp index 244fc511..7ecb96de 100644 --- a/src/iterative_closest_point.cpp +++ b/src/iterative_closest_point.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/lbs_matrix.cpp b/src/lbs_matrix.cpp index 1ba607e4..c36421ac 100644 --- a/src/lbs_matrix.cpp +++ b/src/lbs_matrix.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/line_segment_in_rectangle.cpp b/src/line_segment_in_rectangle.cpp index ee196608..11238d10 100644 --- a/src/line_segment_in_rectangle.cpp +++ b/src/line_segment_in_rectangle.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/local_basis.cpp b/src/local_basis.cpp index 2c99efb6..ac0bd9a1 100644 --- a/src/local_basis.cpp +++ b/src/local_basis.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/look_at.cpp b/src/look_at.cpp index 87c87f30..7535a5b3 100644 --- a/src/look_at.cpp +++ b/src/look_at.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/loop.cpp b/src/loop.cpp index 35880a38..6e397732 100644 --- a/src/loop.cpp +++ b/src/loop.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example #include #include diff --git a/src/lscm.cpp b/src/lscm.cpp index 8537277c..6f5bf112 100644 --- a/src/lscm.cpp +++ b/src/lscm.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example #include #include diff --git a/src/map_vertices_to_circle.cpp b/src/map_vertices_to_circle.cpp index fc99e3f5..b83a8a90 100644 --- a/src/map_vertices_to_circle.cpp +++ b/src/map_vertices_to_circle.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example #include #include diff --git a/src/marching_cubes.cpp b/src/marching_cubes.cpp index 4d423945..c1965213 100644 --- a/src/marching_cubes.cpp +++ b/src/marching_cubes.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Thomas +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/marching_tets.cpp b/src/marching_tets.cpp index 02bad04c..f5bd41aa 100644 --- a/src/marching_tets.cpp +++ b/src/marching_tets.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/massmatrix.cpp b/src/massmatrix.cpp index e5de6433..09928a1a 100644 --- a/src/massmatrix.cpp +++ b/src/massmatrix.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include @@ -39,16 +46,16 @@ npe_default_arg(type, int, 3) npe_begin_code() assert_valid_tet_or_tri_mesh_23d(v, f); - static_assert(int(igl::MASSMATRIX_TYPE_BARYCENTRIC) == 0, "ARAPEnergyType enum changed!"); - static_assert(int(igl::MASSMATRIX_TYPE_VORONOI) == 1, "ARAPEnergyType enum changed!"); - static_assert(int(igl::MASSMATRIX_TYPE_FULL) == 2, "ARAPEnergyType enum changed!"); - static_assert(int(igl::MASSMATRIX_TYPE_DEFAULT) == 3, "ARAPEnergyType enum changed!"); - static_assert(int(igl::NUM_MASSMATRIX_TYPE) == 4, "ARAPEnergyType enum changed!"); + static_assert(int(igl::MASSMATRIX_TYPE_BARYCENTRIC) == 0, "MASSMATRIX enum changed!"); + static_assert(int(igl::MASSMATRIX_TYPE_VORONOI) == 1, "MASSMATRIX enum changed!"); + static_assert(int(igl::MASSMATRIX_TYPE_FULL) == 2, "MASSMATRIX enum changed!"); + static_assert(int(igl::MASSMATRIX_TYPE_DEFAULT) == 3, "MASSMATRIX enum changed!"); + static_assert(int(igl::NUM_MASSMATRIX_TYPES) == 4, "MASSMATRIX enum changed!"); - if (type >= igl::NUM_MASSMATRIX_TYPE) { + if (type >= igl::NUM_MASSMATRIX_TYPES ) { std::string errmsg = std::string("Invalid enum for type should be in the range 0 to ") + - std::to_string(igl::NUM_MASSMATRIX_TYPE-1); + std::to_string(igl::NUM_MASSMATRIX_TYPES-1); throw pybind11::value_error(errmsg); } diff --git a/src/massmatrix_intrinsic.cpp b/src/massmatrix_intrinsic.cpp index 31f029ee..e2375e40 100644 --- a/src/massmatrix_intrinsic.cpp +++ b/src/massmatrix_intrinsic.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include @@ -53,17 +60,17 @@ npe_begin_code() assert_cols_equals(l, 3, "l"); assert_valid_tri_mesh_faces(f); - static_assert(int(igl::MASSMATRIX_TYPE_BARYCENTRIC) == 0, "ARAPEnergyType enum changed!"); - static_assert(int(igl::MASSMATRIX_TYPE_VORONOI) == 1, "ARAPEnergyType enum changed!"); - static_assert(int(igl::MASSMATRIX_TYPE_FULL) == 2, "ARAPEnergyType enum changed!"); - static_assert(int(igl::MASSMATRIX_TYPE_DEFAULT) == 3, "ARAPEnergyType enum changed!"); - static_assert(int(igl::NUM_MASSMATRIX_TYPE) == 4, "ARAPEnergyType enum changed!"); + static_assert(int(igl::MASSMATRIX_TYPE_BARYCENTRIC) == 0, "MASSMATRIX enum changed!"); + static_assert(int(igl::MASSMATRIX_TYPE_VORONOI) == 1, "MASSMATRIX enum changed!"); + static_assert(int(igl::MASSMATRIX_TYPE_FULL) == 2, "MASSMATRIX enum changed!"); + static_assert(int(igl::MASSMATRIX_TYPE_DEFAULT) == 3, "MASSMATRIX enum changed!"); + static_assert(int(igl::NUM_MASSMATRIX_TYPES) == 4, "MASSMATRIX enum changed!"); - if (type >= igl::NUM_MASSMATRIX_TYPE) + if (type >= igl::NUM_MASSMATRIX_TYPES ) { std::string errmsg = std::string("Invalid enum for type should be in the range 0 to ") + - std::to_string(igl::NUM_MASSMATRIX_TYPE - 1); + std::to_string(igl::NUM_MASSMATRIX_TYPES - 1); throw pybind11::value_error(errmsg); } diff --git a/src/min_quad_with_fixed.cpp b/src/min_quad_with_fixed.cpp index 125fef84..2efdb2f9 100644 --- a/src/min_quad_with_fixed.cpp +++ b/src/min_quad_with_fixed.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example remove __copy #include diff --git a/src/moments.cpp b/src/moments.cpp index 85b8df90..ea3a5c38 100644 --- a/src/moments.cpp +++ b/src/moments.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Alec Jacobson +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/mvc.cpp b/src/mvc.cpp index 582b0bae..77f9c236 100644 --- a/src/mvc.cpp +++ b/src/mvc.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/normal_derivative.cpp b/src/normal_derivative.cpp index dff384e4..67c48412 100644 --- a/src/normal_derivative.cpp +++ b/src/normal_derivative.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/offset_surface.cpp b/src/offset_surface.cpp index fa5c7e7f..5c402e90 100644 --- a/src/offset_surface.cpp +++ b/src/offset_surface.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example // TODO: remove __copy // copy is necessary since the winding number only supports matrices diff --git a/src/orient_outward.cpp b/src/orient_outward.cpp index ccaec744..feffad80 100644 --- a/src/orient_outward.cpp +++ b/src/orient_outward.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/orientable_patches.cpp b/src/orientable_patches.cpp index 0dcfeea0..8a56e8a2 100644 --- a/src/orientable_patches.cpp +++ b/src/orientable_patches.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/oriented_facets.cpp b/src/oriented_facets.cpp index fba58178..4e5e69a2 100644 --- a/src/oriented_facets.cpp +++ b/src/oriented_facets.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/outer_element.cpp b/src/outer_element.cpp index de38962a..a60c52a2 100644 --- a/src/outer_element.cpp +++ b/src/outer_element.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/partition.cpp b/src/partition.cpp index a72d4bd1..8088083a 100644 --- a/src/partition.cpp +++ b/src/partition.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/path_to_edges.cpp b/src/path_to_edges.cpp index e83971a2..15fb1204 100644 --- a/src/path_to_edges.cpp +++ b/src/path_to_edges.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/per_corner_normals.cpp b/src/per_corner_normals.cpp index 24042309..c0bb127a 100644 --- a/src/per_corner_normals.cpp +++ b/src/per_corner_normals.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/per_edge_normals.cpp b/src/per_edge_normals.cpp index 5ba3b0c8..9e061c79 100644 --- a/src/per_edge_normals.cpp +++ b/src/per_edge_normals.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __miss __example #include diff --git a/src/per_face_normals.cpp b/src/per_face_normals.cpp index fa3343c7..7945a81e 100644 --- a/src/per_face_normals.cpp +++ b/src/per_face_normals.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __miss #include diff --git a/src/per_vertex_attribute_smoothing.cpp b/src/per_vertex_attribute_smoothing.cpp index cbdc4d8a..acbfe8b9 100644 --- a/src/per_vertex_attribute_smoothing.cpp +++ b/src/per_vertex_attribute_smoothing.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include diff --git a/src/per_vertex_normals.cpp b/src/per_vertex_normals.cpp index 960b68e3..908f9612 100644 --- a/src/per_vertex_normals.cpp +++ b/src/per_vertex_normals.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/piecewise_constant_winding_number.cpp b/src/piecewise_constant_winding_number.cpp index 80c6eb4b..5623b941 100644 --- a/src/piecewise_constant_winding_number.cpp +++ b/src/piecewise_constant_winding_number.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __miss __example #include diff --git a/src/planarize_quad_mesh.cpp b/src/planarize_quad_mesh.cpp index ebcdcec9..df015b4b 100644 --- a/src/planarize_quad_mesh.cpp +++ b/src/planarize_quad_mesh.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/point_in_circle.cpp b/src/point_in_circle.cpp index 79a80d38..573e7b80 100644 --- a/src/point_in_circle.cpp +++ b/src/point_in_circle.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/point_mesh_squared_distance.cpp b/src/point_mesh_squared_distance.cpp index bce94b3c..3f12877d 100644 --- a/src/point_mesh_squared_distance.cpp +++ b/src/point_mesh_squared_distance.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/point_simplex_squared_distance.cpp b/src/point_simplex_squared_distance.cpp index cc8c4b61..69a0488b 100644 --- a/src/point_simplex_squared_distance.cpp +++ b/src/point_simplex_squared_distance.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/polar_dec.cpp b/src/polar_dec.cpp index 48e5c4c5..c8cdc3e0 100644 --- a/src/polar_dec.cpp +++ b/src/polar_dec.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/principal_curvature.cpp b/src/principal_curvature.cpp index eca7e42f..e2b7892f 100644 --- a/src/principal_curvature.cpp +++ b/src/principal_curvature.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/procrustes.cpp b/src/procrustes.cpp index df5c1b15..dd25e4f2 100644 --- a/src/procrustes.cpp +++ b/src/procrustes.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __miss #include diff --git a/src/project.cpp b/src/project.cpp index fc0123a7..48235c91 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/project_isometrically_to_plane.cpp b/src/project_isometrically_to_plane.cpp index 3e7f2ef8..bd7bbbf4 100644 --- a/src/project_isometrically_to_plane.cpp +++ b/src/project_isometrically_to_plane.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/project_to_line.cpp b/src/project_to_line.cpp index 4a99d7ce..a344bdf7 100644 --- a/src/project_to_line.cpp +++ b/src/project_to_line.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/project_to_line_segment.cpp b/src/project_to_line_segment.cpp index 2562c7d2..dc7e0198 100644 --- a/src/project_to_line_segment.cpp +++ b/src/project_to_line_segment.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/pso.cpp b/src/pso.cpp index 55a7d3a4..8a6883d4 100644 --- a/src/pso.cpp +++ b/src/pso.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/qslim.cpp b/src/qslim.cpp index a7c68fdd..da7e6c39 100644 --- a/src/qslim.cpp +++ b/src/qslim.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include diff --git a/src/quad_grid.cpp b/src/quad_grid.cpp index 673c8ecf..79e30a5e 100644 --- a/src/quad_grid.cpp +++ b/src/quad_grid.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/quad_planarity.cpp b/src/quad_planarity.cpp index 07644c15..1aebc241 100644 --- a/src/quad_planarity.cpp +++ b/src/quad_planarity.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: missing __example #include diff --git a/src/ramer_douglas_peucker.cpp b/src/ramer_douglas_peucker.cpp index 0523040b..ba32efb5 100644 --- a/src/ramer_douglas_peucker.cpp +++ b/src/ramer_douglas_peucker.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/random_points_on_mesh.cpp b/src/random_points_on_mesh.cpp index b96c13a9..8be9c20d 100644 --- a/src/random_points_on_mesh.cpp +++ b/src/random_points_on_mesh.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example #include #include @@ -17,6 +24,7 @@ Returns B n by 3 list of barycentric coordinates, ith row are coordinates of ith sampled point in face FI(i) FI n list of indices into F + X n by dim list of sampled points See also -------- @@ -44,7 +52,8 @@ npe_begin_code() assert_valid_23d_tri_mesh(v, f); EigenDenseLike b; EigenDenseLike fi; - igl::random_points_on_mesh(n, v, f, b, fi); - return std::make_tuple(npe::move(b), npe::move(fi)); + EigenDenseLike x; + igl::random_points_on_mesh(n, v, f, b, fi, x); + return std::make_tuple(npe::move(b), npe::move(fi), npe::move(x)); npe_end_code() diff --git a/src/random_points_on_mesh_intrinsic.cpp b/src/random_points_on_mesh_intrinsic.cpp new file mode 100644 index 00000000..b4417754 --- /dev/null +++ b/src/random_points_on_mesh_intrinsic.cpp @@ -0,0 +1,47 @@ +#include +#include +#include +#include + +const char* ds_random_points_on_mesh_intrinsic = R"igl_Qu8mg5v7( +RANDOM_POINTS_ON_MESH Randomly sample a mesh (V,F) n times. +Parameters +---------- + n number of samples + dblA #F list of double areas of triangles + +Returns +------- + B n by 3 list of barycentric coordinates, ith row are coordinates of + ith sampled point in face FI(i) + FI n list of indices into F + +See also +-------- + + +Notes +----- +None + +Examples +-------- + +)igl_Qu8mg5v7"; + +npe_function(random_points_on_mesh_intrinsic) +npe_doc(ds_random_points_on_mesh_intrinsic) + +npe_arg(n, int) +npe_arg(dblA, dense_float, dense_double) + + +npe_begin_code() + + EigenDenseLike b; + EigenDenseInt fi; + igl::random_points_on_mesh_intrinsic(n, dblA, b, fi); + return std::make_tuple(npe::move(b), npe::move(fi)); + +npe_end_code() + diff --git a/src/random_search.cpp b/src/random_search.cpp index 127312c3..25fb39d9 100644 --- a/src/random_search.cpp +++ b/src/random_search.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/ray_box_intersect.cpp b/src/ray_box_intersect.cpp index 49174c3a..8dd913f9 100644 --- a/src/ray_box_intersect.cpp +++ b/src/ray_box_intersect.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/ray_mesh_intersect.cpp b/src/ray_mesh_intersect.cpp index 6357c37f..ba10fd50 100644 --- a/src/ray_mesh_intersect.cpp +++ b/src/ray_mesh_intersect.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/ray_sphere_intersect.cpp b/src/ray_sphere_intersect.cpp index ba6a2a31..13c27f18 100644 --- a/src/ray_sphere_intersect.cpp +++ b/src/ray_sphere_intersect.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/readDMAT.cpp b/src/readDMAT.cpp index 241bcab1..28862c7b 100644 --- a/src/readDMAT.cpp +++ b/src/readDMAT.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include diff --git a/src/readMESH.cpp b/src/readMESH.cpp index e01ab4d4..66e210db 100644 --- a/src/readMESH.cpp +++ b/src/readMESH.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/readMSH.cpp b/src/readMSH.cpp index a4ce2aa1..e51cc02a 100644 --- a/src/readMSH.cpp +++ b/src/readMSH.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/readOBJ.cpp b/src/readOBJ.cpp index f5dc7381..e00c9cc1 100644 --- a/src/readOBJ.cpp +++ b/src/readOBJ.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/readOFF.cpp b/src/readOFF.cpp index d172ea0e..460dee82 100644 --- a/src/readOFF.cpp +++ b/src/readOFF.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/readTGF.cpp b/src/readTGF.cpp index a4dd7035..285ae553 100644 --- a/src/readTGF.cpp +++ b/src/readTGF.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include diff --git a/src/read_triangle_mesh.cpp b/src/read_triangle_mesh.cpp index 5b134b35..0eb32ec2 100644 --- a/src/read_triangle_mesh.cpp +++ b/src/read_triangle_mesh.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/remove_duplicate_vertices.cpp b/src/remove_duplicate_vertices.cpp index 10c7efa7..f9dfe5ad 100644 --- a/src/remove_duplicate_vertices.cpp +++ b/src/remove_duplicate_vertices.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/remove_duplicates.cpp b/src/remove_duplicates.cpp index 22a2b53c..40f68e4c 100644 --- a/src/remove_duplicates.cpp +++ b/src/remove_duplicates.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/remove_unreferenced.cpp b/src/remove_unreferenced.cpp index c28a6124..4dccc4b2 100644 --- a/src/remove_unreferenced.cpp +++ b/src/remove_unreferenced.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include diff --git a/src/resolve_duplicated_faces.cpp b/src/resolve_duplicated_faces.cpp index d0a6fb6e..c2de6cd2 100644 --- a/src/resolve_duplicated_faces.cpp +++ b/src/resolve_duplicated_faces.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/rigid_alignment.cpp b/src/rigid_alignment.cpp index 4fbac065..4f77b3b9 100644 --- a/src/rigid_alignment.cpp +++ b/src/rigid_alignment.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/rotate_vectors.cpp b/src/rotate_vectors.cpp index 67add880..c78e1693 100644 --- a/src/rotate_vectors.cpp +++ b/src/rotate_vectors.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/sample_edges.cpp b/src/sample_edges.cpp index dc7f3ea9..6d20ad67 100644 --- a/src/sample_edges.cpp +++ b/src/sample_edges.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/segment_segment_intersect.cpp b/src/segment_segment_intersect.cpp index 16cb4f90..be7edf1d 100644 --- a/src/segment_segment_intersect.cpp +++ b/src/segment_segment_intersect.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example // error at line 33 and 41, saying cross is only for certain size matrices diff --git a/src/shape_diameter_function.cpp b/src/shape_diameter_function.cpp index 48538918..2cec006f 100644 --- a/src/shape_diameter_function.cpp +++ b/src/shape_diameter_function.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example __miss diff --git a/src/sharp_edges.cpp b/src/sharp_edges.cpp index 6a20018c..b2fb2b6c 100644 --- a/src/sharp_edges.cpp +++ b/src/sharp_edges.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/signed_angle.cpp b/src/signed_angle.cpp index d4a63e73..36b1ac40 100644 --- a/src/signed_angle.cpp +++ b/src/signed_angle.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/signed_distance.cpp b/src/signed_distance.cpp index fdcfd242..3a40971f 100644 --- a/src/signed_distance.cpp +++ b/src/signed_distance.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Francis Williams +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/simplify_polyhedron.cpp b/src/simplify_polyhedron.cpp index 591e37e9..a707fd18 100644 --- a/src/simplify_polyhedron.cpp +++ b/src/simplify_polyhedron.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/snap_points.cpp b/src/snap_points.cpp index 51148549..65791641 100644 --- a/src/snap_points.cpp +++ b/src/snap_points.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/solid_angle.cpp b/src/solid_angle.cpp index 6d5be82d..7eb0118f 100644 --- a/src/solid_angle.cpp +++ b/src/solid_angle.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/sort_angles.cpp b/src/sort_angles.cpp index 354a080f..2cd96779 100644 --- a/src/sort_angles.cpp +++ b/src/sort_angles.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include diff --git a/src/sparse_voxel_grid.cpp b/src/sparse_voxel_grid.cpp index 1fe3c805..08127abf 100644 --- a/src/sparse_voxel_grid.cpp +++ b/src/sparse_voxel_grid.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/swept_volume_bounding_box.cpp b/src/swept_volume_bounding_box.cpp index 691bddb9..980d85b3 100644 --- a/src/swept_volume_bounding_box.cpp +++ b/src/swept_volume_bounding_box.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/tet_tet_adjacency.cpp b/src/tet_tet_adjacency.cpp index 5a604500..81f7fc1f 100644 --- a/src/tet_tet_adjacency.cpp +++ b/src/tet_tet_adjacency.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example #include diff --git a/src/topological_hole_fill.cpp b/src/topological_hole_fill.cpp index a0346cc7..cc92d8a3 100644 --- a/src/topological_hole_fill.cpp +++ b/src/topological_hole_fill.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include @@ -15,7 +22,6 @@ Parameters ---------- F #F by simplex-size list of element indices -b #b boundary indices to preserve holes vector of hole loops to fill Returns @@ -39,15 +45,14 @@ Examples npe_function(topological_hole_fill) npe_doc(ds_topological_hole_fill) -npe_arg(f, dense_int, dense_long) -npe_arg(b, dense_int, dense_long) +npe_arg(f, dense_int, dense_long ) npe_arg(holes, std::vector>) npe_begin_code() EigenDense f_filled; - igl::topological_hole_fill(f, b, holes, f_filled); + igl::topological_hole_fill(f, holes, f_filled); return npe::move(f_filled); npe_end_code() diff --git a/src/triangle/triangulate.cpp b/src/triangle/triangulate.cpp new file mode 100644 index 00000000..2eb2668e --- /dev/null +++ b/src/triangle/triangulate.cpp @@ -0,0 +1,71 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Alec Jacobson +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. +#include + +#include +#include + +#include + +const char* ds_triangulate = R"igl_Qu8mg5v7( +Triangulate the interior of a polygon using the triangle library. + +Parameters +---------- + V : #V by 2 list of 2D vertex positions + E : #E by 2 list of vertex ids forming unoriented edges of the boundary of the polygon + H : #H by 2 coordinates of points contained inside holes of the polygon + flags : string of options pass to triangle (see triangle documentation) +Returns +-------- + V2 #V2 by 2 coordinates of the vertives of the generated triangulation + F2 #F2 by 3 list of indices forming the faces of the generated triangulation + +)igl_Qu8mg5v7"; + +npe_function(triangulate) +npe_doc(ds_triangulate) + +npe_arg(V, dense_float, dense_double) +// remove dense_longlong when https://github.com/libigl/libigl-python-bindings/actions/runs/4152507964 gets merged +npe_arg(E, dense_int, dense_long, dense_longlong) +npe_default_arg(H, npe_matches(V) ,pybind11::array()) +npe_default_arg(flags, std::string, "") +npe_default_arg(VM, npe_matches(E), pybind11::array()) +npe_default_arg(EM, npe_matches(E), pybind11::array()) +npe_begin_code() + +EigenDenseLike V2; +EigenDenseLike F2; +EigenDenseLike VM2,E2,EM2; +using V2Type = decltype(V2); +using F2Type = decltype(F2); +using VM2Type = decltype(VM2); +using E2Type = decltype(E2); +using EM2Type = decltype(EM2); +if(VM.size() == 0 && EM.size() == 0) +{ + igl::triangle::triangulate(V, E, H, flags, V2, F2); + return std::list({npe::move(V2), npe::move(F2)}); +}else +{ + igl::triangle::triangulate(V, E, H, VM.reshaped(), EM.reshaped(), flags, V2, F2, VM2, E2, EM2); + if(VM.size() && EM.size()) + { + return std::list({npe::move(V2), npe::move(F2), npe::move(VM2), npe::move(E2), npe::move(EM2)}); + }else if(VM.size()) + { + return std::list({npe::move(V2), npe::move(F2), npe::move(VM2)}); + }else + { + return std::list({npe::move(V2), npe::move(F2), npe::move(E2), npe::move(EM2)}); + } +} + +npe_end_code() + diff --git a/src/triangle_fan.cpp b/src/triangle_fan.cpp index 0301a8fd..0309ffb2 100644 --- a/src/triangle_fan.cpp +++ b/src/triangle_fan.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/triangle_triangle_adjacency.cpp b/src/triangle_triangle_adjacency.cpp index 1b93a7c4..c04d4f69 100644 --- a/src/triangle_triangle_adjacency.cpp +++ b/src/triangle_triangle_adjacency.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __miss __example #include diff --git a/src/triangles_from_strip.cpp b/src/triangles_from_strip.cpp index e4f85ab1..619bf7b1 100644 --- a/src/triangles_from_strip.cpp +++ b/src/triangles_from_strip.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/triangulated_grid.cpp b/src/triangulated_grid.cpp index 70b8a84a..0440bb0f 100644 --- a/src/triangulated_grid.cpp +++ b/src/triangulated_grid.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/two_axis_valuator_fixed_up.cpp b/src/two_axis_valuator_fixed_up.cpp index ab4c0f63..58657313 100644 --- a/src/two_axis_valuator_fixed_up.cpp +++ b/src/two_axis_valuator_fixed_up.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/uniformly_sample_two_manifold.cpp b/src/uniformly_sample_two_manifold.cpp index b9cde94e..99a757ad 100644 --- a/src/uniformly_sample_two_manifold.cpp +++ b/src/uniformly_sample_two_manifold.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __example #include diff --git a/src/unique_edge_map.cpp b/src/unique_edge_map.cpp index 9feedfbb..840d3192 100644 --- a/src/unique_edge_map.cpp +++ b/src/unique_edge_map.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/unique_simplices.cpp b/src/unique_simplices.cpp index 2353f529..9af8508c 100644 --- a/src/unique_simplices.cpp +++ b/src/unique_simplices.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/unproject.cpp b/src/unproject.cpp index 3ba821d9..e8e0028a 100644 --- a/src/unproject.cpp +++ b/src/unproject.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example #include #include diff --git a/src/unproject_in_mesh.cpp b/src/unproject_in_mesh.cpp index f61f571c..00f4767b 100644 --- a/src/unproject_in_mesh.cpp +++ b/src/unproject_in_mesh.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/unproject_on_line.cpp b/src/unproject_on_line.cpp index 28160462..2fc701a1 100644 --- a/src/unproject_on_line.cpp +++ b/src/unproject_on_line.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/unproject_on_plane.cpp b/src/unproject_on_plane.cpp index eabfcfd7..c09f860e 100644 --- a/src/unproject_on_plane.cpp +++ b/src/unproject_on_plane.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/unproject_onto_mesh.cpp b/src/unproject_onto_mesh.cpp index a44bb591..efcb4e06 100644 --- a/src/unproject_onto_mesh.cpp +++ b/src/unproject_onto_mesh.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __miss __example #include diff --git a/src/unproject_ray.cpp b/src/unproject_ray.cpp index 39335161..c7c677f5 100644 --- a/src/unproject_ray.cpp +++ b/src/unproject_ray.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include diff --git a/src/upsample.cpp b/src/upsample.cpp index bf11ef25..3ef321e3 100644 --- a/src/upsample.cpp +++ b/src/upsample.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example //TODO: __miss upsample that retuns a sparse matrix and inplace #include diff --git a/src/vector_area_matrix.cpp b/src/vector_area_matrix.cpp index 887d50ab..77de4b38 100644 --- a/src/vector_area_matrix.cpp +++ b/src/vector_area_matrix.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/vertex_components.cpp b/src/vertex_components.cpp index 0d807d0d..5f456bc3 100644 --- a/src/vertex_components.cpp +++ b/src/vertex_components.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/vertex_triangle_adjacency.cpp b/src/vertex_triangle_adjacency.cpp index 52f4719c..f50eb9c8 100644 --- a/src/vertex_triangle_adjacency.cpp +++ b/src/vertex_triangle_adjacency.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 KarlLeell +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. // TODO: __miss __example #include diff --git a/src/volume.cpp b/src/volume.cpp index 7caf0544..4e82bf1e 100644 --- a/src/volume.cpp +++ b/src/volume.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/winding_number.cpp b/src/winding_number.cpp index faf8e6bc..7848805a 100644 --- a/src/winding_number.cpp +++ b/src/winding_number.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example // TODO: remove __copy // copy is necessary since the winding number only supports matrices diff --git a/src/writeDMAT.cpp b/src/writeDMAT.cpp index 9edff143..20df82b5 100644 --- a/src/writeDMAT.cpp +++ b/src/writeDMAT.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Alec Jacobson +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include diff --git a/src/writeOBJ.cpp b/src/writeOBJ.cpp index f56d868c..27c9d947 100644 --- a/src/writeOBJ.cpp +++ b/src/writeOBJ.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Sebastian Koch +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/writeOFF.cpp b/src/writeOFF.cpp index 6351ab62..133de489 100644 --- a/src/writeOFF.cpp +++ b/src/writeOFF.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Daniele Panozzo +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. #include #include #include diff --git a/src/write_triangle_mesh.cpp b/src/write_triangle_mesh.cpp index e4f1db5f..25ec5df6 100644 --- a/src/write_triangle_mesh.cpp +++ b/src/write_triangle_mesh.cpp @@ -1,3 +1,10 @@ +// This file is part of libigl, a simple c++ geometry processing library. +// +// Copyright (C) 2023 Teseo Schneider +// +// This Source Code Form is subject to the terms of the Mozilla Public License +// v. 2.0. If a copy of the MPL was not distributed with this file, You can +// obtain one at http://mozilla.org/MPL/2.0/. //TODO: __example #include diff --git a/tests/test_basic.py b/tests/test_basic.py index 1aa0b59a..5bc524fa 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -3,6 +3,8 @@ import platform import igl +import igl.triangle +import igl.copyleft.cgal import numpy as np import scipy as sp import scipy.sparse as csc @@ -520,13 +522,16 @@ def test_hausdorff(self): def test_isolines(self): func = np.random.rand(self.v1.shape[0], 1) - iso_v, iso_e = igl.isolines(self.v1, self.f1, func, 10) + vals = np.linspace(0,1, 10) + iso_v, iso_e, I = igl.isolines(self.v1, self.f1, func, vals) self.assertEqual(iso_v.dtype, func.dtype) self.assertEqual(iso_e.dtype, self.f1.dtype) self.assertEqual(iso_e.shape[1], 2) + self.assertEqual(iso_e.shape[0], I.shape[0]) self.assertTrue(iso_v.flags.c_contiguous) self.assertTrue(iso_e.flags.c_contiguous) + self.assertTrue(I.flags.c_contiguous) def test_unproject_ray(self): pos = np.random.rand(2, 1) @@ -574,16 +579,20 @@ def test_upsample(self): def test_random_points_on_mesh(self): n = 10 - b, fi = igl.random_points_on_mesh(n, self.v1, self.f1) + b, fi, x = igl.random_points_on_mesh(n, self.v1, self.f1) self.assertEqual(b.dtype, self.v1.dtype) + self.assertEqual(x.dtype, self.v1.dtype) self.assertEqual(fi.dtype, self.f1.dtype) self.assertEqual(b.shape[0], n) self.assertEqual(b.shape[1], 3) + self.assertEqual(x.shape[0], n) + self.assertEqual(x.shape[1], self.v1.shape[1]) self.assertEqual(fi.shape[0], n) self.assertTrue(b.flags.c_contiguous) self.assertTrue(fi.flags.c_contiguous) + self.assertTrue(x.flags.c_contiguous) def test_boundary_loop(self): l = igl.boundary_loop(self.f) @@ -725,10 +734,6 @@ def test_euler_characteristic(self): eu = igl.euler_characteristic(self.f1) self.assertEqual(type(eu), int) - def test_euler_characteristic_complete(self): - eu = igl.euler_characteristic_complete(self.v1, self.f1) - self.assertEqual(type(eu), int) - def test_fit_plane(self): n, c = igl.fit_plane(self.v1) self.assertTrue(n.dtype == c.dtype == self.v1.dtype) @@ -1025,8 +1030,10 @@ def test_bbw(self): C, BE, _, _, _, _ = igl.read_tgf( os.path.join(self.test_data_path, "hand.tgf")) - ok, b, bc = igl.boundary_conditions(V, T, C, np.array( - [], dtype=T.dtype), BE, np.array([], dtype=T.dtype)) + ok, b, bc = igl.boundary_conditions( + V, T, C, np.array([], dtype=T.dtype), BE, + np.array([], dtype=T.dtype), + np.array([], dtype=T.dtype)) self.assertTrue(b.flags.c_contiguous) self.assertTrue(bc.flags.c_contiguous) @@ -1108,7 +1115,7 @@ def test_lscm(self): self.assertTrue(uv.flags.c_contiguous) def test_is_irregular_vertex(self): - is_i = igl.is_irregular_vertex(self.v1, self.f1) + is_i = igl.is_irregular_vertex(self.f1) self.assertEqual(type(is_i[0]), bool) def test_harmonic(self): @@ -2352,9 +2359,8 @@ def sphere1(point): def test_topological_hole_fill(self): f = self.f1 - b = np.array(range(10)) h = [range(10, 20)] - ff = igl.topological_hole_fill(f, b, h) + ff = igl.topological_hole_fill(f, h) self.assertTrue(ff.flags.c_contiguous) self.assertTrue(ff.shape[1] == 3) self.assertTrue(ff.dtype == f.dtype) @@ -2468,5 +2474,69 @@ def test_flip_edge(self): emap.dtype == self.f1.dtype) self.assertTrue(np.array(ue2e).dtype == self.f1.dtype) + def test_AABB(self): + tree = igl.AABB_f64_3() + tree.init(self.v1,self.f1) + bc = igl.barycenter(self.v1,self.f1) + sqrD = tree.squared_distance(self.v1,self.f1,bc) + self.assertTrue(sqrD.shape[0] == bc.shape[0]) + self.assertTrue(np.max(sqrD) <= 1e-16) + sqrD,I,C = tree.squared_distance(self.v1,self.f1,bc,return_index=True,return_closest_point=True) + self.assertTrue(sqrD.shape[0] == bc.shape[0]) + self.assertTrue(I.shape[0] == bc.shape[0]) + self.assertTrue(C.shape == bc.shape) + + def test_in_element_3(self): + V = np.array([ [0.,0,0], [1,0,0], [0,1,0], [0,0,1], [1,1,1]],dtype='float64') + T = np.array([[0,1,2,3],[4,3,2,1]],dtype='int32') + Q = np.array([[0.1,0.1,0.1],[0.9,0.9,0.9]],dtype='float64') + tree = igl.AABB_f64_3() + tree.init(V,T) + I = igl.in_element_3(V,T,Q,tree) + self.assertTrue(I.shape[0] == Q.shape[0]) + self.assertTrue(I[0] == 0) + self.assertTrue(I[1] == 1) + + def test_in_element_2(self): + V = np.array([ [0.,0], [1,0], [0,1], [1,1]],dtype='float64') + F = np.array([[0,1,2],[2,1,3]],'int32') + Q = np.array([[0.1,0.1],[0.9,0.9]],dtype='float64') + tree = igl.AABB_f64_2() + tree.init(V,F) + I = igl.in_element_2(V,F,Q,tree) + self.assertTrue(I.shape[0] == Q.shape[0]) + self.assertTrue(I[0] == 0) + self.assertTrue(I[1] == 1) + + + def test_triangulate(self): + V = np.array([[0,0],[1,0],[1,1],[0,1]],dtype='float64') + E = np.array([[0,1],[1,2],[2,3],[3,0]]) + V2,F2 = igl.triangle.triangulate(V,E,flags='Q') + self.assertTrue(V2.shape == V.shape) + self.assertTrue(F2.shape == (2,3)) + V = np.array([[0,0],[4,0],[0,4],[1,1],[1,2],[2,1]],dtype='float64') + E = np.array([[0,1],[1,2],[2,0],[3,4],[4,5],[5,3]]) + H = np.array([[1.1,1.1]]) + # Markers can't be 0 + VM = 1+np.array(range(V.shape[0])) + EM = 1+np.array(range(E.shape[0])) + V2,F2,VM2,E2,EM2 = igl.triangle.triangulate(V,E,H,flags='Q',VM=VM,EM=EM) + self.assertTrue(V2.shape == V.shape) + self.assertTrue(F2.shape == (3*2,3)) + self.assertTrue(VM2.shape == VM.shape) + self.assertTrue(E2.shape == E.shape) + self.assertTrue(EM2.shape == EM.shape) + + + # copyleft.cgal + def test_convex_hull(self): + V = np.array([[0,0,0],[1,0,0],[0,1,0],[0,0,1]],dtype="float64") + F = igl.copyleft.cgal.convex_hull(V) + F = np.sort(F) + F = F[np.lexsort(F.T[::-1],axis=0)] + F_gt = np.array([[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]],dtype="int64") + self.assertTrue((F == F_gt).all()) + if __name__ == '__main__': unittest.main() diff --git a/tutorial/contributing.md b/tutorial/contributing.md index 0b288a40..5136a43b 100644 --- a/tutorial/contributing.md +++ b/tutorial/contributing.md @@ -7,11 +7,8 @@ If you want to contribute and expose additional features, thank you! For any new binding please create a new pull request on git, if everything looks good we will merge it. -**Note 1**, see your new feature in the conda version it might require some time, since we are planning to accumulate several fixes and -features before publishing a new version on conda. - -**Note 2** we are not planning to bind any function not under MIT/LGLP licence since it would make the whole package not LGPL. If you plan to bind something dependent on CGAL/Triangle/TetGen, don't do it. - +**Note 1**, see your new feature in the conda/pip version it might require some time, since we are planning to accumulate several fixes and +features before publishing a new version on conda/PPI. The general rule of thumb is to keep the python side clean, and copy/hack in the binding if necessary. In such a way, if something is fixed (on igl or the bindings) it will not break any python code. diff --git a/tutorial/index.md b/tutorial/index.md index a3a6f333..4abe8aa2 100644 --- a/tutorial/index.md +++ b/tutorial/index.md @@ -1,9 +1,8 @@ igl python bindings =================== -[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge) -[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/downloads.svg)](https://anaconda.org/conda-forge/igl) -[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/platforms.svg)](https://anaconda.org/conda-forge/igl) +[![PyPI version](https://badge.fury.io/py/libigl.svg)](https://pypi.org/project/libigl/) +[![buildwheels](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml/badge.svg)](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml?query=branch%3Amain) !!! warning @@ -11,9 +10,9 @@ igl python bindings [libigl](https://libigl.github.io) is a simple C++ geometry processing library. We have a wide functionality including construction of sparse discrete differential geometry operators and finite-elements matrices such as the cotangent Laplacian and diagonalized mass matrix, simple facet, and edge-based topology data structures. -All these functionalities are now available through python and can be easily installed with conda: +All these functionalities are now available through python and can be easily installed with pip: ```bash -conda install -c conda-forge igl +python -m pip install libigl ``` We provide a complete jupyter version of the tutorials and the full [documentation](igl_docs.md). diff --git a/tutorial/tut-chapter0.ipynb b/tutorial/tut-chapter0.ipynb index e20fa7fd..fe064ab7 100644 --- a/tutorial/tut-chapter0.ipynb +++ b/tutorial/tut-chapter0.ipynb @@ -5,10 +5,8 @@ "metadata": {}, "source": [ "# Chapter 0\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/downloads.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/platforms.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/latest_release_date.svg)](https://anaconda.org/conda-forge/igl)\n", + "[![PyPI version](https://badge.fury.io/py/libigl.svg)](https://pypi.org/project/libigl/)\n", + "[![buildwheels](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml/badge.svg)](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml?query=branch%3Amain)\n", "\n", "![](images/libigl-logo.jpg)" ] @@ -35,15 +33,15 @@ "\n", "\n", "## Downloading Libigl\n", - "Libigl can be downloaded from [Conda forge](https://anaconda.org/conda-forge/igl):\n", + "Libigl can be downloaded from [PyPI](https://pypi.org/project/libigl/):\n", "```\n", - "conda install -c conda-forge igl \n", + "python -m pip install libigl \n", "```\n", "\n", "\n", - "All of libigl functionality depends only on `numpy` and `scipy`. For the visualization in this tutorial we use [meshplot](https://anaconda.org/conda-forge/meshplot) which can be easily installed from Conda:\n", + "All of libigl functionality depends only on `numpy` and `scipy`. For the visualization in this tutorial we use [meshplot](https://github.com/skoch9/meshplot) which can be easily installed from Conda:\n", "```\n", - "conda install -c conda-forge meshplot \n", + "pip install https://github.com/skoch9/meshplot/archive/0.4.0.tar.gz \n", "```\n", "\n", "\n", diff --git a/tutorial/tut-chapter1.ipynb b/tutorial/tut-chapter1.ipynb index 9626b6ee..65f3647b 100644 --- a/tutorial/tut-chapter1.ipynb +++ b/tutorial/tut-chapter1.ipynb @@ -5,10 +5,8 @@ "metadata": {}, "source": [ "# Chapter 1: Discrete Geometric Quantities and Operators\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/downloads.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/platforms.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/latest_release_date.svg)](https://anaconda.org/conda-forge/igl)" + "[![PyPI version](https://badge.fury.io/py/libigl.svg)](https://pypi.org/project/libigl/)\n", + "[![buildwheels](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml/badge.svg)](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml?query=branch%3Amain)" ] }, { diff --git a/tutorial/tut-chapter2.ipynb b/tutorial/tut-chapter2.ipynb index 6f6e8096..297687a3 100644 --- a/tutorial/tut-chapter2.ipynb +++ b/tutorial/tut-chapter2.ipynb @@ -5,10 +5,8 @@ "metadata": {}, "source": [ "# Chapter 2: Matrices and Linear Algebra\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/downloads.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/platforms.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/latest_release_date.svg)](https://anaconda.org/conda-forge/igl)" + "[![PyPI version](https://badge.fury.io/py/libigl.svg)](https://pypi.org/project/libigl/)\n", + "[![buildwheels](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml/badge.svg)](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml?query=branch%3Amain)" ] }, { diff --git a/tutorial/tut-chapter3.ipynb b/tutorial/tut-chapter3.ipynb index 180f8840..57f6a77b 100644 --- a/tutorial/tut-chapter3.ipynb +++ b/tutorial/tut-chapter3.ipynb @@ -5,10 +5,8 @@ "metadata": {}, "source": [ "# Chapter 3: Shape deformation\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/downloads.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/platforms.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/latest_release_date.svg)](https://anaconda.org/conda-forge/igl)" + "[![PyPI version](https://badge.fury.io/py/libigl.svg)](https://pypi.org/project/libigl/)\n", + "[![buildwheels](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml/badge.svg)](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml?query=branch%3Amain)" ] }, { diff --git a/tutorial/tut-chapter4.ipynb b/tutorial/tut-chapter4.ipynb index 350fde11..c058ed08 100644 --- a/tutorial/tut-chapter4.ipynb +++ b/tutorial/tut-chapter4.ipynb @@ -5,10 +5,8 @@ "metadata": {}, "source": [ "# Chapter 4: Parametrization\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/downloads.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/platforms.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/latest_release_date.svg)](https://anaconda.org/conda-forge/igl)" + "[![PyPI version](https://badge.fury.io/py/libigl.svg)](https://pypi.org/project/libigl/)\n", + "[![buildwheels](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml/badge.svg)](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml?query=branch%3Amain)" ] }, { diff --git a/tutorial/tut-chapter5.ipynb b/tutorial/tut-chapter5.ipynb index 94d58d8b..739a230e 100644 --- a/tutorial/tut-chapter5.ipynb +++ b/tutorial/tut-chapter5.ipynb @@ -5,10 +5,8 @@ "metadata": {}, "source": [ "# Chapter 5: External libraries\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/downloads.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/platforms.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/latest_release_date.svg)](https://anaconda.org/conda-forge/igl)" + "[![PyPI version](https://badge.fury.io/py/libigl.svg)](https://pypi.org/project/libigl/)\n", + "[![buildwheels](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml/badge.svg)](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml?query=branch%3Amain)" ] }, { diff --git a/tutorial/tut-chapter6.ipynb b/tutorial/tut-chapter6.ipynb index 4aebfdb8..f4b48a22 100644 --- a/tutorial/tut-chapter6.ipynb +++ b/tutorial/tut-chapter6.ipynb @@ -5,10 +5,8 @@ "metadata": {}, "source": [ "# Chapter 6: Miscellaneous\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/downloads.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/platforms.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/latest_release_date.svg)](https://anaconda.org/conda-forge/igl)" + "[![PyPI version](https://badge.fury.io/py/libigl.svg)](https://pypi.org/project/libigl/)\n", + "[![buildwheels](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml/badge.svg)](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml?query=branch%3Amain)" ] }, { diff --git a/tutorial/tut-chapter7.ipynb b/tutorial/tut-chapter7.ipynb index e255bbb1..e8aa2c80 100644 --- a/tutorial/tut-chapter7.ipynb +++ b/tutorial/tut-chapter7.ipynb @@ -5,10 +5,8 @@ "metadata": {}, "source": [ "# Chapter 7: Skinned Shape Deformation\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/downloads.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/platforms.svg)](https://anaconda.org/conda-forge/igl)\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/latest_release_date.svg)](https://anaconda.org/conda-forge/igl)" + "[![PyPI version](https://badge.fury.io/py/libigl.svg)](https://pypi.org/project/libigl/)\n", + "[![buildwheels](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml/badge.svg)](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml?query=branch%3Amain)" ] }, { @@ -34,7 +32,7 @@ "import igl\n", "import scipy as sp\n", "import numpy as np\n", - "import scripts.meshplot as mp\n", + "import meshplot as mp\n", "\n", "import os\n", "\n", diff --git a/tutorial/tutorials.ipynb b/tutorial/tutorials.ipynb index c434a390..aa5b8bd8 100644 --- a/tutorial/tutorials.ipynb +++ b/tutorial/tutorials.ipynb @@ -5,13 +5,9 @@ "metadata": {}, "source": [ "## Libigl Tutorials\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/installer/conda.svg)](https://conda.anaconda.org/conda-forge)\n", + "[![PyPI version](https://badge.fury.io/py/libigl.svg)](https://pypi.org/project/libigl/)\n", "\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/downloads.svg)](https://anaconda.org/conda-forge/igl)\n", - "\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/platforms.svg)](https://anaconda.org/conda-forge/igl)\n", - "\n", - "[![Anaconda-Server Badge](https://anaconda.org/conda-forge/igl/badges/latest_release_date.svg)](https://anaconda.org/conda-forge/igl)\n", + "[![buildwheels](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml/badge.svg)](https://github.com/libigl/libigl-python-bindings/actions/workflows/wheels.yml?query=branch%3Amain)\n", "\n", "![](images/libigl-logo.jpg)\n", "\n", @@ -42,15 +38,15 @@ "\n", "\n", "### Downloading Libigl\n", - "Libigl can be downloaded from [Conda forge](https://anaconda.org/conda-forge/igl):\n", + "Libigl can be downloaded from [PyPI](https://pypi.org/project/libigl/):\n", "```\n", - "conda install -c conda-forge igl \n", + "python -m pip install libigl \n", "```\n", "\n", "\n", - "All of libigl functionality depends only on `numpy` and `scipy`. For the visualization in this tutorial we use [meshplot](https://anaconda.org/conda-forge/meshplot) which can be easily installed from Conda:\n", + "All of libigl functionality depends only on `numpy` and `scipy`. For the visualization in this tutorial we use [meshplot](https://github.com/skoch9/meshplot) which can be easily installed from Conda:\n", "```\n", - "conda install -c conda-forge meshplot \n", + "python -m pip install https://github.com/skoch9/meshplot/archive/0.4.0.tar.gz \n", "```\n", "\n", "\n", @@ -70,11 +66,11 @@ "\n", "import os\n", "root_folder = os.getcwd()\n", - "#root_folder = os.path.join(os.getcwd(), \"tutorial\")", + "#root_folder = os.path.join(os.getcwd(), \"tutorial\")\n", "data_folder = os.path.join(root_folder,\"/data\")\n", "# pip install gitpython\n", "from git import Repo\n", - "if not os.path.isdir(data_folder):\n" + "if not os.path.isdir(data_folder):\n", " Repo.clone_from(\"https://github.com/libigl/libigl-tutorial-data.git\", data_folder)\n", "\n" ]