1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

Compare commits

...

13 Commits

Author SHA1 Message Date
bugmaster
913295d5dd 0027631: license.md duplicated in the current master HEAD 2016-06-23 17:45:15 +03:00
ifv
9c1519c4c5 0027108: GCPnt_TangentialDeflection does not respect linear deflection
Modification of algorithm in order to prevent violation of angular and curvature deflection condition for smooth intervals of curve.
Modification of algorithm for calculation of maximal deflection in command crvtpoints, crvpoints (CR25649)
Elementary bug fixing in algorithm GCPnts_UniformDeflection.gxx
Modification of test cases in order to set new reference parameters of shape triangulations
Some tests:
  bugs modalg_2 bug397
  mesh standard_incmesh C7, V3
  mesh standard_incmesh_parallel C7, V3
  mesh standard_mesh C7, V3
  mesh standard_shading V3
were modified by TODO with reference bug 27226, because some problems in meshing algorithm (package BRepMesh) were discovered when tessellation of edges was changed. These problems cannot be solved by modification of GCPnts_TangentialDeflection algorithm. New issue #27226 was created, see bugtracker for details.

Correction of test data

Test case for issue #27108

Modification of algorithm for improving performance

Correction of test cases
2016-06-16 14:58:40 +03:00
Martin Siggel
6f21399c0d 0027447: Add support for long IGES entity names
Adding support for long IGES names.
The method IGESCAFControl_Writer::WriteNames is now extended
to also write IGES 406 / 15 name entities containing the full label name.

Test case for issue #27447
2016-06-16 14:58:35 +03:00
apl
9d1bf7ae05 0027601: TKV3d, AIS_RubberBand - polygonal selection mode invokes an exception with convex fill area
Corrected allocation of primitive array for triangles.
2016-06-16 14:58:30 +03:00
kgv
1b9f5d9504 0027596: Visualization, StdPrs_WFShape - pack isolines into single group of primitives
StdPrs_ShadedShape, computeFaceBoundaries() now does not create additional temporary buffer for edges.
StdPrs_Isolines::AddOnTriangulation() now reconstacts polylines from segments projected onto triangulation.

StdPrs_WFShape::Add() now packs isolines into single group in presentation (instead of per-face group).
Even more - StdPrs_WFShape now groups lines with the same aspects.

Prs3d_Drawer::UIsoAspect(), ::VIsoAspect(), ::VIsoAspect() - default width
has been changed from 0.5 to 1.0.
2016-06-16 14:58:24 +03:00
apl
907fb7a5e0 0027591: TKViewerTest, ViewerTest_CmdParser regression - methods ArgVec3f, ArgVec3d return inccorect values
Fix regression in methods ViewerTest_CmdParser::ArgVec3f, ::ArgVec3d, ::ArgVec, ::ArgPnt.
2016-06-16 14:58:18 +03:00
isn
9d671cd1b0 0027391: BRepLib::EnsureNormalConsistency() raises exception in case of asynchronious PolygonOnTriangulation problem
additional check have been added to BRepLib::EnsureNormalConsistency() func.
Any edges with two adjacent faces will be skipped (while updating of their normals) if the number of discretization points (nodes) will be different for each of this faces on this edge.

test case
2016-06-16 12:21:02 +03:00
abv
bd80ecfa61 0027602: gp_TrsfForm.hxx - wrong comment to enum
Comment is corrected
2016-06-16 12:18:56 +03:00
abv
747db83cdd 0027599: Test "demo samples snowflake" does not clear internal data after execution
Useless save command is removed
2016-06-16 12:17:16 +03:00
aml
6728599615 0027569: [Regression in 6.9.0] Projecting a curve hangs
Parameterization speed is taken into account to avoid ProjLib projector usage in case of bad input data.
Test case is added.
Test cases correction.
2016-06-16 12:15:22 +03:00
ika
f117cc5a81 0027329: Export to STEP failure
Do ProcessShape for non-manifold too,
Add binding of already written shared faces to STEP entity for non-manifold.

Minor correction of test case bugs/step/bug27329
2016-06-16 12:11:40 +03:00
apl
67e26cc101 0027592: TKV3d, AIS_RubberBand - SWIG error for method void virtual ComputeSelection
Commit modifies "AIS_RubberBand.hxx" header file.
- Adds declaration of handle.
- Puts virtual & void modifiers of ComputeSelection method in common order.
2016-06-16 12:08:07 +03:00
nbv
77a6c8313f 0027581: Logical error in Bnd_Box(2d)::SquareExtent() method.
Code in method SquareExtent has been corrected.
2016-06-09 15:34:40 +03:00
61 changed files with 1323 additions and 1107 deletions

View File

@@ -1,521 +0,0 @@
License {#occt_public_license}
=======
Open CASCADE Technology is available under GNU Lesser General Public License
(LGPL) version 2.1 with additional exception.
@section license_lgpl_21 GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
### Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
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 this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
### TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
- 0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
1. The modified work must itself be a software library.
2. You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
3. You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
4. If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
1. Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
2. Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
3. Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
4. If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
5. Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
1. Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
2. Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
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
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser 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 Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
**NO** **WARRANTY**
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
### END OF TERMS AND CONDITIONS
### How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
@section occt_lgpl_exception OPEN CASCADE EXCEPTION
### Open CASCADE Exception (version 1.0) to GNU LGPL version 2.1.
The object code (i.e. not a source) form of a "work that uses the Library"
can incorporate material from a header file that is part of the Library.
As a special exception to the GNU Lesser General Public License version 2.1,
you may distribute such object code incorporating material from header files
provided with the Open CASCADE Technology libraries (including code of CDL
generic classes) under terms of your choice, provided that you give
prominent notice in supporting documentation to this code that it makes use
of or is based on facilities provided by the Open CASCADE Technology software.

View File

@@ -86,7 +86,6 @@ bfuse w w w5
shape wsh Sh
foreach f [explode w f] {add $f wsh}
renamevar wsh w
save w w.brep
unifysamedom r w
# keep only wires in compound

View File

@@ -324,7 +324,7 @@ Standard_Boolean AIS_RubberBand::fillTriangles()
Standard_Boolean toFill = Standard_False;
if (myTriangles.IsNull() || myTriangles->VertexNumber() != myPoints.Length() + 1)
if (myTriangles.IsNull() || myTriangles->VertexNumber() != aTriangles.Extent() * 3)
{
toFill = Standard_True;
myTriangles = new Graphic3d_ArrayOfTriangles (aTriangles.Extent() * 3, 0, Standard_True);

View File

@@ -22,6 +22,8 @@
#include <Graphic3d_Vec2.hxx>
#include <NCollection_Sequence.hxx>
DEFINE_STANDARD_HANDLE(AIS_RubberBand, AIS_InteractiveObject)
//! Presentation for drawing rubber band selection.
//! It supports rectangle and polygonal selection.
//! It is constructed in 2d overlay.
@@ -130,8 +132,8 @@ protected:
const Standard_Integer theMode) Standard_OVERRIDE;
//! Does not fill selection primitives for rubber band.
void virtual ComputeSelection (const Handle(SelectMgr_Selection)& /*aSelection*/,
const Standard_Integer /*aMode*/) Standard_OVERRIDE { };
virtual void ComputeSelection (const Handle(SelectMgr_Selection)& /*aSelection*/,
const Standard_Integer /*aMode*/) Standard_OVERRIDE { };
//! Fills triangles primitive array for rubber band filling.
//! It uses Delaunay triangulation.

View File

@@ -81,7 +81,7 @@ protected:
private:
protected:
Quantity_Color MyColor;

View File

@@ -1899,6 +1899,10 @@ Standard_Boolean BRepLib::
TShort_Array1OfShortReal& aNormArr1 = aPT1->ChangeNormals();
TShort_Array1OfShortReal& aNormArr2 = aPT2->ChangeNormals();
if (aPTEF1->Nodes().Lower() != aPTEF2->Nodes().Lower() ||
aPTEF1->Nodes().Upper() != aPTEF2->Nodes().Upper())
continue;
for(Standard_Integer anEdgNode = aPTEF1->Nodes().Lower();
anEdgNode <= aPTEF1->Nodes().Upper(); anEdgNode++)
{

View File

@@ -21,8 +21,8 @@
inline Standard_Real Bnd_Box::SquareExtent() const
{
if ( IsVoid() ) return 0.;
Standard_Real dx = Xmax-Xmin+Gap;
Standard_Real dy = Ymax-Ymin+Gap;
Standard_Real dz = Zmax-Zmin+Gap;
return dx*dx + dy*dy + dz*dz;
const Standard_Real aDx = Xmax - Xmin + Gap + Gap;
const Standard_Real aDy = Ymax - Ymin + Gap + Gap;
const Standard_Real aDz = Zmax - Zmin + Gap + Gap;
return aDx*aDx + aDy*aDy + aDz*aDz;
}

View File

@@ -238,8 +238,8 @@ inline Standard_Boolean Bnd_Box2d::IsOut (const gp_Trsf2d& T1,
inline Standard_Real Bnd_Box2d::SquareExtent() const
{
if ( IsVoid() ) return 0.;
Standard_Real dx = Xmax-Xmin+Gap;
Standard_Real dy = Ymax-Ymin+Gap;
return dx*dx + dy*dy;
const Standard_Real aDx = Xmax - Xmin + Gap + Gap;
const Standard_Real aDy = Ymax - Ymin + Gap + Gap;
return aDx*aDx + aDy*aDy;
}

View File

@@ -24,3 +24,7 @@ GCPnts_UniformDeflection.cxx
GCPnts_UniformDeflection.gxx
GCPnts_UniformDeflection.hxx
GCPnts_UniformDeflection.lxx
GCPnts_DistFunction.hxx
GCPnts_DistFunction.cxx
GCPnts_DistFunction2d.hxx
GCPnts_DistFunction2d.cxx

View File

@@ -0,0 +1,73 @@
// Copyright (c) 2014-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <GCPnts_DistFunction.hxx>
#include <gp_Pnt.hxx>
//=======================================================================
//function : MaxCurvLinDist
//purpose :
//=======================================================================
GCPnts_DistFunction::GCPnts_DistFunction(const Adaptor3d_Curve& theCurve,
const Standard_Real U1, const Standard_Real U2)
: myCurve(theCurve),
myU1(U1), myU2(U2)
{
gp_Pnt P1 = theCurve.Value(U1), P2 = theCurve.Value(U2);
myLin = gp_Lin(P1, P2.XYZ() - P1.XYZ());
}
//
//=======================================================================
//function : Value
//purpose :
//=======================================================================
Standard_Boolean GCPnts_DistFunction::Value (const Standard_Real X,
Standard_Real& F)
{
if (X < myU1 || X > myU2)
return Standard_False;
//
F = -myLin.SquareDistance(myCurve.Value(X));
return Standard_True;
}
//=======================================================================
//function : MaxCurvLinDistMV
//purpose :
//=======================================================================
GCPnts_DistFunctionMV::GCPnts_DistFunctionMV(GCPnts_DistFunction& theCurvLinDist)
: myMaxCurvLinDist(theCurvLinDist)
{
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
Standard_Boolean GCPnts_DistFunctionMV::Value (const math_Vector& X,
Standard_Real& F)
{
Standard_Boolean Ok = myMaxCurvLinDist.Value(X(1), F);
return Ok;
}
//=======================================================================
//function : NbVariables
//purpose :
//=======================================================================
Standard_Integer GCPnts_DistFunctionMV::NbVariables() const
{
return 1;
}

View File

@@ -0,0 +1,67 @@
// Copyright (c) 2014-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _GCPnts_DistFunction_HeaderFile
#define _GCPnts_DistFunction_HeaderFile
#include <gp_Lin.hxx>
#include <math_Function.hxx>
#include <math_MultipleVarFunction.hxx>
#include <Adaptor3d_Curve.hxx>
class gp_Pnt;
//! Class to define function, which calculates square distance between point on curve
//! C(u), U1 <= u <= U2 and line passing through points C(U1) and C(U2)
//! This function is used in any minimisation algorithm to define maximal deviation between curve and line,
//! which required one variable function without derivative (for ex. math_BrentMinimum)
class GCPnts_DistFunction : public math_Function
{
public:
Standard_EXPORT GCPnts_DistFunction(const Adaptor3d_Curve& theCurve,
const Standard_Real U1, const Standard_Real U2);
//
Standard_EXPORT GCPnts_DistFunction(const GCPnts_DistFunction& theOther);
Standard_EXPORT virtual Standard_Boolean Value (const Standard_Real X,
Standard_Real& F);
private:
GCPnts_DistFunction & operator = (const GCPnts_DistFunction & theOther);
const Adaptor3d_Curve& myCurve;
gp_Lin myLin;
Standard_Real myU1;
Standard_Real myU2;
};
//
//! The same as class GCPnts_DistFunction, but it can be used in minimization algorithms that
//! requires multi variable function
class GCPnts_DistFunctionMV : public math_MultipleVarFunction
{
public:
Standard_EXPORT GCPnts_DistFunctionMV(GCPnts_DistFunction& theCurvLinDist);
Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X,
Standard_Real& F);
Standard_EXPORT virtual Standard_Integer NbVariables() const;
private:
GCPnts_DistFunctionMV & operator = (const GCPnts_DistFunctionMV & theOther);
GCPnts_DistFunction& myMaxCurvLinDist;
};
//
#endif // _GCPnts_DistFunction_HeaderFile

View File

@@ -0,0 +1,76 @@
// Copyright (c) 2014-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <GCPnts_DistFunction2d.hxx>
#include <gp_Pnt2d.hxx>
//=======================================================================
//function : GCPnts_DistFunction2d
//purpose :
//=======================================================================
GCPnts_DistFunction2d::GCPnts_DistFunction2d(const Adaptor2d_Curve2d& theCurve,
const Standard_Real U1, const Standard_Real U2)
: myCurve(theCurve),
myU1(U1), myU2(U2)
{
gp_Pnt2d P2d1 = theCurve.Value(U1), P2d2 = theCurve.Value(U2);
myLin = gp_Lin2d(P2d1, P2d2.XY() - P2d1.XY());
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
Standard_Boolean GCPnts_DistFunction2d::Value (const Standard_Real X,
Standard_Real& F)
{
if (X < myU1 || X > myU2)
return Standard_False;
//
gp_Pnt2d aP2d = myCurve.Value(X);
F = -myLin.SquareDistance(aP2d);
return Standard_True;
}
//
//=======================================================================
//function : GCPnts_DistFunction2dMV
//purpose :
//=======================================================================
GCPnts_DistFunction2dMV::GCPnts_DistFunction2dMV(GCPnts_DistFunction2d& theCurvLinDist)
: myMaxCurvLinDist(theCurvLinDist)
{
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
Standard_Boolean GCPnts_DistFunction2dMV::Value (const math_Vector& X,
Standard_Real& F)
{
Standard_Boolean Ok = myMaxCurvLinDist.Value(X(1), F);
return Ok;
}
//=======================================================================
//function : NbVariables
//purpose :
//=======================================================================
Standard_Integer GCPnts_DistFunction2dMV::NbVariables() const
{
return 1;
}

View File

@@ -0,0 +1,68 @@
// Copyright (c) 2014-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef _GCPnts_DistFunction2d_HeaderFile
#define _GCPnts_DistFunction2d_HeaderFile
#include <gp_Lin2d.hxx>
#include <math_Function.hxx>
#include <math_MultipleVarFunction.hxx>
#include <Adaptor2d_Curve2d.hxx>
class gp_Pnt2d;
//! Class to define function, which calculates square distance between point on curve
//! C(u), U1 <= u <= U2 and line passing through points C(U1) and C(U2)
//! This function is used in any minimisation algorithm to define maximal deviation between curve and line,
//! which required one variable function without derivative (for ex. math_BrentMinimum)
class GCPnts_DistFunction2d : public math_Function
{
public:
Standard_EXPORT GCPnts_DistFunction2d(const Adaptor2d_Curve2d& theCurve,
const Standard_Real U1, const Standard_Real U2);
//
Standard_EXPORT GCPnts_DistFunction2d(const GCPnts_DistFunction2d& theOther);
Standard_EXPORT virtual Standard_Boolean Value (const Standard_Real X,
Standard_Real& F);
private:
GCPnts_DistFunction2d & operator = (const GCPnts_DistFunction2d & theOther);
const Adaptor2d_Curve2d& myCurve;
gp_Lin2d myLin;
Standard_Real myU1;
Standard_Real myU2;
};
//
//! The same as class GCPnts_DistFunction2d,
//! but it can be used in minimization algorithms that
//! requires multi variable function
class GCPnts_DistFunction2dMV : public math_MultipleVarFunction
{
public:
Standard_EXPORT GCPnts_DistFunction2dMV(GCPnts_DistFunction2d& theCurvLinDist);
Standard_EXPORT virtual Standard_Boolean Value (const math_Vector& X,
Standard_Real& F);
Standard_EXPORT virtual Standard_Integer NbVariables() const;
private:
GCPnts_DistFunction2dMV & operator = (const GCPnts_DistFunction2dMV & theOther);
GCPnts_DistFunction2d& myMaxCurvLinDist;
};
//
#endif // _GCPnts_DistFunction2d_HeaderFile

View File

@@ -64,6 +64,22 @@ static void D2 (const Adaptor2d_Curve2d& C, const Standard_Real U,
VV2.SetCoord (X, Y, 0.0);
}
static Standard_Real EstimAngl(const gp_Pnt& P1, const gp_Pnt& Pm, const gp_Pnt& P2)
{
gp_Vec V1(P1, Pm), V2(Pm, P2);
Standard_Real L = V1.Magnitude() * V2.Magnitude();
//
if(L > gp::Resolution())
{
return V1.CrossMagnitude(V2)/L;
}
else
{
return 0.;
}
}
// Return number of interval of continuity on which theParam is located.
// Last parameter is used to increase search speed.
static Standard_Integer getIntervalIdx(const Standard_Real theParam,
@@ -81,7 +97,7 @@ static Standard_Integer getIntervalIdx(const Standard_Real theParam,
}
return anIdx;
}
//
//=======================================================================
//function : CPnts_TangentialDeflection
//purpose :
@@ -161,22 +177,32 @@ Standard_Real GCPnts_TangentialDeflection::ArcAngularStep(
#include <Geom_BezierCurve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <gp_Circ.hxx>
#include <GCPnts_DistFunction.hxx>
#define TheCurve Adaptor3d_Curve
#define Handle_TheBezierCurve Handle(Geom_BezierCurve)
#define Handle_TheBSplineCurve Handle(Geom_BSplineCurve)
#define TheMaxCurvLinDist GCPnts_DistFunction
#define TheMaxCurvLinDistMV GCPnts_DistFunctionMV
#include <GCPnts_TangentialDeflection.gxx>
#undef Handle_TheBezierCurve
#undef Handle_TheBSplineCurve
#undef TheCurve
#undef TheMaxCurvLinDist
#undef TheMaxCurvLinDistMV
#include <Geom2d_BezierCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <gp_Circ2d.hxx>
#include <GCPnts_DistFunction2d.hxx>
#define TheCurve Adaptor2d_Curve2d
#define Handle_TheBezierCurve Handle(Geom2d_BezierCurve)
#define Handle_TheBSplineCurve Handle(Geom2d_BSplineCurve)
#define TheMaxCurvLinDist GCPnts_DistFunction2d
#define TheMaxCurvLinDistMV GCPnts_DistFunction2dMV
#include <GCPnts_TangentialDeflection.gxx>
#undef Handle_TheBezierCurve
#undef Handle_TheBSplineCurve
#undef TheCurve
#undef TheMaxCurvLinDist
#undef TheMaxCurvLinDistMV

View File

@@ -21,6 +21,9 @@
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp.hxx>
#include <NCollection_List.hxx>
#include <math_PSO.hxx>
#include <math_BrentMinimum.hxx>
#define Us3 0.3333333333333333333333333333
@@ -254,7 +257,11 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
Standard_Real U1 = firstu;
Standard_Real LTol = Precision::Confusion (); //protection longueur nulle
Standard_Real ATol = Precision::Angular (); //protection angle nul
Standard_Real ATol = 1.e-2 * angularDeflection;
if(ATol > 1.e-2)
ATol = 1.e-2;
else if(ATol < 1.e-7)
ATol = 1.e-7;
D0 (C, lastu, LastPoint);
@@ -272,7 +279,7 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
TColStd_Array1OfReal Intervs(1, NbInterv+1);
C.Intervals(Intervs, GeomAbs_CN);
if (NotDone) {
if (NotDone || Du > 5. * Dusave) {
//C'est soit une droite, soit une singularite :
V1 = (LastPoint.XYZ() - CurrentPoint.XYZ());
L1 = V1.Modulus ();
@@ -281,6 +288,21 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
//Si c'est une droite on verifie en calculant minNbPoints :
Standard_Boolean IsLine = Standard_True;
Standard_Integer NbPoints = (minNbPnts > 3) ? minNbPnts : 3;
switch (C.GetType()) {
case GeomAbs_BSplineCurve:
{
Handle_TheBSplineCurve BS = C.BSpline() ;
NbPoints = Max(BS->Degree() + 1, NbPoints);
break;
}
case GeomAbs_BezierCurve:
{
Handle_TheBezierCurve BZ = C.Bezier();
NbPoints = Max(BZ->Degree() + 1, NbPoints);
break;
}
default:
;}
////
Standard_Real param = 0.;
for (i = 1; i <= NbInterv && IsLine; ++i)
@@ -563,4 +585,94 @@ void GCPnts_TangentialDeflection::PerformCurve (const TheCurve& C)
i++;
}
}
//Additional check for intervals
Standard_Real MinLen2 = myMinLen * myMinLen;
Standard_Integer MaxNbp = 10 * Nbp;
for(i = 1; i < Nbp; ++i)
{
U1 = parameters(i);
U2 = parameters(i + 1);
// Check maximal deflection on interval;
Standard_Real dmax = 0.;
Standard_Real umax = 0.;
Standard_Real amax = 0.;
EstimDefl(C, U1, U2, dmax, umax);
const gp_Pnt& P1 = points(i);
const gp_Pnt& P2 = points(i+1);
D0(C, umax, MiddlePoint);
amax = EstimAngl(P1, MiddlePoint, P2);
if(dmax > curvatureDeflection || amax > AngleMax)
{
if(umax - U1 > uTol && U2 - umax > uTol)
{
if (P1.SquareDistance(MiddlePoint) > MinLen2 && P2.SquareDistance(MiddlePoint) > MinLen2)
{
parameters.InsertAfter(i, umax);
points.InsertAfter(i, MiddlePoint);
++Nbp;
--i; //To compensate ++i in loop header: i must point to first part of splitted interval
if(Nbp > MaxNbp)
{
break;
}
}
}
}
}
//
}
//=======================================================================
//function : EstimDefl
//purpose : Estimation of maximal deflection for interval [U1, U2]
//
//=======================================================================
void GCPnts_TangentialDeflection::EstimDefl (const TheCurve& C,
const Standard_Real U1, const Standard_Real U2,
Standard_Real& MaxDefl, Standard_Real& UMax)
{
Standard_Real Du = (lastu - firstu);
//
TheMaxCurvLinDist aFunc(C, U1, U2);
//
const Standard_Integer aNbIter = 100;
Standard_Real reltol = Max(1.e-3, 2.*uTol/((Abs(U1) + Abs(U2))));
//
math_BrentMinimum anOptLoc(reltol, aNbIter, uTol);
anOptLoc.Perform(aFunc, U1, (U1+U2)/2., U2);
if(anOptLoc.IsDone())
{
MaxDefl = Sqrt(-anOptLoc.Minimum());
UMax = anOptLoc.Location();
return;
}
//
math_Vector aLowBorder(1,1);
math_Vector aUppBorder(1,1);
math_Vector aSteps(1,1);
//
aSteps(1) = Max(0.1 * Du, 100. * uTol);
Standard_Integer aNbParticles = Max(8, RealToInt(32 * (U2 - U1) / Du));
//
aLowBorder(1) = U1;
aUppBorder(1) = U2;
//
//
Standard_Real aValue;
math_Vector aT(1,1);
TheMaxCurvLinDistMV aFuncMV(aFunc);
math_PSO aFinder(&aFuncMV, aLowBorder, aUppBorder, aSteps, aNbParticles);
aFinder.Perform(aSteps, aValue, aT);
//
anOptLoc.Perform(aFunc, Max(aT(1) - aSteps(1), U1) , aT(1), Min(aT(1) + aSteps(1),U2));
if(anOptLoc.IsDone())
{
MaxDefl = Sqrt(-anOptLoc.Minimum());
UMax = anOptLoc.Location();
return;
}
MaxDefl = Sqrt(-aValue);
UMax = aT(1);
//
}

View File

@@ -27,19 +27,20 @@
#include <TColStd_SequenceOfReal.hxx>
#include <Standard_Boolean.hxx>
#include <gp_Pnt.hxx>
#include <gp_Lin.hxx>
#include <math_Function.hxx>
#include <math_MultipleVarFunction.hxx>
#include <Adaptor3d_Curve.hxx>
#include <Adaptor2d_Curve2d.hxx>
class Standard_ConstructionError;
class Standard_OutOfRange;
class Adaptor3d_Curve;
class Adaptor2d_Curve2d;
class gp_Pnt;
//! Computes a set of points on a curve from package
//! Adaptor3d such as between two successive points
//! P1(u1)and P2(u2) :
//!
//! . ||P1P3^P3P2||/||P1P3||*||P3P2||<AngularDeflection
//! . ||P1P2^P1P3||/||P1P2||*||P1P3||<CurvatureDeflection
//! . ||P1P2^P1P3||/||P1P2||<CurvatureDeflection
//!
//! where P3 is the point of abscissa ((u1+u2)/2), with
//! u1 the abscissa of the point P1 and u2 the abscissa
@@ -69,10 +70,12 @@ class gp_Pnt;
//! U = PointsOnCurve.Parameter (i);
//! P = PointsOnCurve.Value (i);
//! }
class GCPnts_TangentialDeflection
{
public:
//
DEFINE_STANDARD_ALLOC
@@ -136,6 +139,11 @@ private:
Standard_EXPORT void EvaluateDu (const Adaptor2d_Curve2d& C, const Standard_Real U, gp_Pnt& P, Standard_Real& Du, Standard_Boolean& NotDone) const;
Standard_EXPORT void EstimDefl (const Adaptor3d_Curve& C, const Standard_Real U1, const Standard_Real U2,
Standard_Real& MaxDefl, Standard_Real& UMax);
Standard_EXPORT void EstimDefl (const Adaptor2d_Curve2d& C, const Standard_Real U1, const Standard_Real U2,
Standard_Real& MaxDefl, Standard_Real& UMax);
Standard_Real angularDeflection;
Standard_Real curvatureDeflection;

View File

@@ -186,7 +186,7 @@ static Standard_Boolean PerformComposite (TColStd_SequenceOfReal& Parameters,
// remove last point to avoid duplication
Parameters.Remove (Parameters.Length());
Points.Remove (Parameters.Length());
Points.Remove (Points.Length());
Ua = Ub;
}

View File

@@ -111,6 +111,7 @@
#include <GCPnts_QuasiUniformDeflection.hxx>
#include <GCPnts_UniformDeflection.hxx>
#include <GCPnts_TangentialDeflection.hxx>
#include <GCPnts_DistFunction.hxx>
#include <GeomAPI_ExtremaCurveCurve.hxx>
#include <gce_MakeLin.hxx>
#include <TColStd_Array1OfBoolean.hxx>
@@ -831,97 +832,11 @@ static Standard_Integer movelaw (Draw_Interpretor& di, Standard_Integer n, const
//Static method computing deviation of curve and polyline
#include <math_PSO.hxx>
#include <math_PSOParticlesPool.hxx>
#include <math_MultipleVarFunctionWithHessian.hxx>
#include <math_NewtonMinimum.hxx>
class aMaxCCDist : public math_MultipleVarFunctionWithHessian
{
public:
aMaxCCDist(const Handle(Geom_Curve)& theCurve,
const Handle(Geom_BSplineCurve)& thePnts)
: myCurve(theCurve),
myPnts(thePnts)
{
}
virtual Standard_Boolean Value (const math_Vector& X,
Standard_Real& F)
{
if (!CheckInputData(X(1)))
{
return Standard_False;
}
F = -myCurve->Value(X(1)).SquareDistance(myPnts->Value(X(1)));
return Standard_True;
}
virtual Standard_Boolean Gradient (const math_Vector& X, math_Vector& G)
{
if (!CheckInputData(X(1)))
{
return Standard_False;
}
gp_Pnt aPnt1, aPnt2;
gp_Vec aVec1, aVec2;
myCurve->D1(X(1), aPnt1, aVec1);
myPnts->D1 (X(1), aPnt2, aVec2);
G(1) = 2 * (aPnt1.X() - aPnt2.X()) * (aVec1.X() - aVec2.X())
+ 2 * (aPnt1.Y() - aPnt2.Y()) * (aVec1.Y() - aVec2.Y())
+ 2 * (aPnt1.Z() - aPnt2.Z()) * (aVec1.Z() - aVec2.Z());
G(1) *= -1.0; // Maximum search.
return Standard_True;
}
virtual Standard_Boolean Values (const math_Vector& X, Standard_Real& F, math_Vector& G, math_Matrix& H)
{
if (Value(X, F) && Gradient(X, G))
{
gp_Pnt aPnt1, aPnt2;
gp_Vec aVec11, aVec12, aVec21, aVec22;
myCurve->D2(X(1), aPnt1, aVec11, aVec12);
myPnts->D2 (X(1), aPnt2, aVec21, aVec22);
H(1,1) = 2 * (aVec11.X() - aVec21.X()) * (aVec11.X() - aVec21.X())
+ 2 * (aVec11.Y() - aVec21.Y()) * (aVec11.Y() - aVec21.Y())
+ 2 * (aVec11.Z() - aVec21.Z()) * (aVec11.Z() - aVec21.Z())
+ 2 * (aPnt1.X() - aPnt2.X()) * (aVec12.X() - aVec22.X())
+ 2 * (aPnt1.Y() - aPnt2.Y()) * (aVec12.Y() - aVec22.Y())
+ 2 * (aPnt1.Z() - aPnt2.Z()) * (aVec12.Z() - aVec22.Z());
H(1,1) *= -1.0; // Maximum search.
return Standard_True;
}
return Standard_False;
}
virtual Standard_Boolean Values (const math_Vector& X, Standard_Real& F, math_Vector& G)
{
return (Value(X, F) && Gradient(X, G));
}
virtual Standard_Integer NbVariables() const
{
return 1;
}
private:
aMaxCCDist & operator = (const aMaxCCDist & theOther);
Standard_Boolean CheckInputData(Standard_Real theParam)
{
if (theParam < myCurve->FirstParameter() ||
theParam > myCurve->LastParameter())
return Standard_False;
return Standard_True;
}
const Handle(Geom_Curve)& myCurve;
const Handle(Geom_BSplineCurve)& myPnts;
};
#include <math_MultipleVarFunction.hxx>
#include <math_BrentMinimum.hxx>
static Standard_Real CompLocalDev(const Handle(Geom_Curve)& theCurve,
const Standard_Real u1, const Standard_Real u2);
static void ComputeDeviation(const Handle(Geom_Curve)& theCurve,
const Handle(Geom_BSplineCurve)& thePnts,
@@ -939,42 +854,76 @@ static void ComputeDeviation(const Handle(Geom_Curve)& theCurve,
Standard_Integer nbp = thePnts->NbKnots();
TColStd_Array1OfReal aKnots(1, nbp);
thePnts->Knots(aKnots);
math_Vector aLowBorder(1,1);
math_Vector aUppBorder(1,1);
math_Vector aSteps(1,1);
Standard_Integer i;
for(i = 1; i < nbp; ++i)
{
aLowBorder(1) = aKnots(i);
aUppBorder(1) = aKnots(i+1);
aSteps(1) =(aUppBorder(1) - aLowBorder(1)) * 0.01; // Run PSO on even distribution with 100 points.
Standard_Real aValue;
math_Vector aT(1,1);
aMaxCCDist aFunc(theCurve, thePnts);
math_PSO aFinder(&aFunc, aLowBorder, aUppBorder, aSteps); // Choose 32 best points from 100 above.
aFinder.Perform(aSteps, aValue, aT);
Standard_Real d = 0.;
math_NewtonMinimum anOptLoc(aFunc);
anOptLoc.Perform(aFunc, aT);
if (anOptLoc.IsDone())
Standard_Real u1 = aKnots(i), u2 = aKnots(i+1);
Standard_Real d = CompLocalDev(theCurve, u1, u2);
if(d > theDmax)
{
d = -anOptLoc.Minimum();
if(d > theDmax)
{
theDmax = d;
theUfMax = aLowBorder(1);
theUlMax = aUppBorder(1);
theImax = i;
}
theDmax = d;
theImax = i;
theUfMax = u1;
theUlMax = u2;
}
}
theDmax = Sqrt(theDmax); // Convert to Euclidean distance.
}
Standard_Real CompLocalDev(const Handle(Geom_Curve)& theCurve,
const Standard_Real u1, const Standard_Real u2)
{
math_Vector aLowBorder(1,1);
math_Vector aUppBorder(1,1);
math_Vector aSteps(1,1);
GeomAdaptor_Curve TCurve(theCurve);
//
aLowBorder(1) = u1;
aUppBorder(1) = u2;
aSteps(1) =(aUppBorder(1) - aLowBorder(1)) * 0.01; // Run PSO on even distribution with 100 points.
//
GCPnts_DistFunction aFunc1(TCurve, u1, u2);
//
Standard_Real aValue;
math_Vector aT(1,1);
GCPnts_DistFunctionMV aFunc(aFunc1);
math_PSO aFinder(&aFunc, aLowBorder, aUppBorder, aSteps); // Choose 32 best points from 100 above.
aFinder.Perform(aSteps, aValue, aT);
Standard_Real d = 0.;
Standard_Real d1, d2;
Standard_Real x1 = Max(u1, aT(1) - aSteps(1));
Standard_Boolean Ok = aFunc1.Value(x1, d1);
if(!Ok)
{
return Sqrt(-aValue);
}
Standard_Real x2 = Min(u2, aT(1) + aSteps(1));
Ok = aFunc1.Value(x2, d2);
if(!Ok)
{
return Sqrt(-aValue);
}
if(!(d1 > aValue && d2 > aValue))
{
Standard_Real dmin = Min(d1, Min(aValue, d2));
return Sqrt(-dmin);
}
math_BrentMinimum anOptLoc(Precision::PConfusion());
anOptLoc.Perform(aFunc1, x1, aT(1), x2);
if (anOptLoc.IsDone())
{
d = -anOptLoc.Minimum();
}
else
{
d = -aValue;
}
return Sqrt(d);
}
//=======================================================================
//function : crvpoints
@@ -1083,6 +1032,7 @@ static Standard_Integer crvtpoints (Draw_Interpretor& di, Standard_Integer n, co
//check deviation
ComputeDeviation(C,aPnts,dmax,ufmax,ulmax,imax);
//
di << "Max defl: " << dmax << " " << ufmax << " " << ulmax << " " << imax << "\n";
return 0;

View File

@@ -60,7 +60,19 @@ public:
Standard_EXPORT const Handle(Graphic3d_ShaderProgram)& ShaderProgram() const;
//! Check for equality with another line aspect.
bool IsEqual (const Graphic3d_AspectLine3d& theOther)
{
if (this == &theOther)
{
return true;
}
return MyShaderProgram == theOther.MyShaderProgram
&& MyType == theOther.MyType
&& MyColor == theOther.MyColor
&& MyWidth == theOther.MyWidth;
}
DEFINE_STANDARD_RTTIEXT(Graphic3d_AspectLine3d,Aspect_AspectLine)

View File

@@ -21,10 +21,12 @@
#include <IGESGraph_Color.hxx>
#include <IGESGraph_DefinitionLevel.hxx>
#include <IGESSolid_Face.hxx>
#include <IGESBasic_Name.hxx>
#include <NCollection_DataMap.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TCollection_HExtendedString.hxx>
#include <TColStd_HSequenceOfExtendedString.hxx>
#include <TDataStd_Name.hxx>
#include <TDF_ChildIterator.hxx>
@@ -526,6 +528,14 @@ Standard_Boolean IGESCAFControl_Writer::WriteNames (const TDF_LabelSequence& the
anAsciiName->SetValue (aNameLength+1, IsAnAscii (aName.Value (aCharPos)) ? (Standard_Character )aName.Value (aCharPos) : '?');
}
anIGESEntity->SetLabel (anAsciiName);
// Set long IGES name using 406 form 15 entity
Handle(IGESBasic_Name) aLongNameEntity = new IGESBasic_Name;
Handle(TCollection_HExtendedString) aTmpStr = new TCollection_HExtendedString(aName);
aLongNameEntity->Init(1, new TCollection_HAsciiString(aTmpStr, '_'));
anIGESEntity->AddProperty(aLongNameEntity);
AddEntity(aLongNameEntity);
}
}

View File

@@ -14,13 +14,17 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Prs3d.hxx>
#include <Bnd_Box.hxx>
#include <BRepBndLib.hxx>
#include <gp_Pnt.hxx>
#include <Prs3d.hxx>
#include <Graphic3d_Group.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_Root.hxx>
#include <TopoDS_Shape.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
//=======================================================================
//function : MatchSegment
@@ -78,3 +82,56 @@ Standard_Real Prs3d::GetDeflection (const TopoDS_Shape& theShape,
}
return aDeflection;
}
//==================================================================
// function: PrimitivesFromPolylines
// purpose:
//==================================================================
Handle(Graphic3d_ArrayOfPrimitives) Prs3d::PrimitivesFromPolylines (const Prs3d_NListOfSequenceOfPnt& thePoints)
{
if (thePoints.IsEmpty())
{
return Handle(Graphic3d_ArrayOfPrimitives)();
}
Standard_Integer aNbVertices = 0;
for (Prs3d_NListOfSequenceOfPnt::Iterator anIt (thePoints); anIt.More(); anIt.Next())
{
aNbVertices += anIt.Value()->Length();
}
const Standard_Integer aSegmentEdgeNb = (aNbVertices - thePoints.Size()) * 2;
Handle(Graphic3d_ArrayOfSegments) aSegments = new Graphic3d_ArrayOfSegments (aNbVertices, aSegmentEdgeNb);
for (Prs3d_NListOfSequenceOfPnt::Iterator anIt (thePoints); anIt.More(); anIt.Next())
{
const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
Standard_Integer aSegmentEdge = aSegments->VertexNumber() + 1;
aSegments->AddVertex (aPoints->First());
for (Standard_Integer aPntIter = aPoints->Lower() + 1; aPntIter <= aPoints->Upper(); ++aPntIter)
{
aSegments->AddVertex (aPoints->Value (aPntIter));
aSegments->AddEdge ( aSegmentEdge);
aSegments->AddEdge (++aSegmentEdge);
}
}
return aSegments;
}
//==================================================================
// function: AddPrimitivesGroup
// purpose:
//==================================================================
void Prs3d::AddPrimitivesGroup (const Handle(Prs3d_Presentation)& thePrs,
const Handle(Prs3d_LineAspect)& theAspect,
Prs3d_NListOfSequenceOfPnt& thePolylines)
{
Handle(Graphic3d_ArrayOfPrimitives) aPrims = Prs3d::PrimitivesFromPolylines (thePolylines);
thePolylines.Clear();
if (!aPrims.IsNull())
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePrs);
aGroup->SetPrimitivesAspect (theAspect->Aspect());
aGroup->AddPrimitiveArray (aPrims);
}
}

View File

@@ -17,34 +17,18 @@
#ifndef _Prs3d_HeaderFile
#define _Prs3d_HeaderFile
#include <Graphic3d_ArrayOfPrimitives.hxx>
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Boolean.hxx>
#include <Quantity_Length.hxx>
#include <Standard_Real.hxx>
#include <Prs3d_Drawer.hxx>
class gp_Pnt;
#include <Prs3d_NListOfSequenceOfPnt.hxx>
class TopoDS_Shape;
class Prs3d_Presentation;
class Prs3d_BasicAspect;
class Prs3d_PointAspect;
class Prs3d_LineAspect;
class Prs3d_ShadingAspect;
class Prs3d_TextAspect;
class Prs3d_IsoAspect;
class Prs3d_ArrowAspect;
class Prs3d_PlaneAspect;
class Prs3d_DimensionAspect;
class Prs3d_DatumAspect;
class Prs3d_Projector;
class Prs3d_PlaneSet;
class Prs3d_Root;
class Prs3d_Text;
class Prs3d_ShapeTool;
class Prs3d_Arrow;
//! The Prs3d package provides the following services
//! - a presentation object (the context for all
@@ -64,7 +48,6 @@ class Prs3d
public:
DEFINE_STANDARD_ALLOC
//! draws an arrow at a given location, with respect
//! to a given direction.
@@ -84,44 +67,16 @@ public:
//! between different representations of the shape and undesirable visual artifacts.
Standard_EXPORT static Standard_Real GetDeflection (const TopoDS_Shape& theShape, const Handle(Prs3d_Drawer)& theDrawer);
//! Assembles array of primitives for sequence of polylines.
//! @param thePoints [in] the polylines sequence
//! @return array of primitives
Standard_EXPORT static Handle(Graphic3d_ArrayOfPrimitives) PrimitivesFromPolylines (const Prs3d_NListOfSequenceOfPnt& thePoints);
protected:
private:
friend class Prs3d_Presentation;
friend class Prs3d_BasicAspect;
friend class Prs3d_PointAspect;
friend class Prs3d_LineAspect;
friend class Prs3d_ShadingAspect;
friend class Prs3d_TextAspect;
friend class Prs3d_IsoAspect;
friend class Prs3d_ArrowAspect;
friend class Prs3d_PlaneAspect;
friend class Prs3d_DimensionAspect;
friend class Prs3d_DatumAspect;
friend class Prs3d_Projector;
friend class Prs3d_PlaneSet;
friend class Prs3d_Root;
friend class Prs3d_Text;
friend class Prs3d_ShapeTool;
friend class Prs3d_Arrow;
//! Add primitives into new group in presentation and clear the list of polylines.
Standard_EXPORT static void AddPrimitivesGroup (const Handle(Prs3d_Presentation)& thePrs,
const Handle(Prs3d_LineAspect)& theAspect,
Prs3d_NListOfSequenceOfPnt& thePolylines);
};
#endif // _Prs3d_HeaderFile

View File

@@ -474,7 +474,7 @@ const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::UIsoAspect()
}
if (myUIsoAspect.IsNull())
{
myUIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5, 1);
myUIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1);
}
}
return myUIsoAspect;
@@ -506,7 +506,7 @@ const Handle(Prs3d_IsoAspect)& Prs3d_Drawer::VIsoAspect()
}
if (myVIsoAspect.IsNull())
{
myVIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5, 1);
myVIsoAspect = new Prs3d_IsoAspect (Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 1.0, 1);
}
}
return myVIsoAspect;
@@ -827,7 +827,7 @@ const Handle(Prs3d_LineAspect)& Prs3d_Drawer::HiddenLineAspect()
}
if (myHiddenLineAspect.IsNull())
{
myHiddenLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_DASH, 0.5);
myHiddenLineAspect = new Prs3d_LineAspect (Quantity_NOC_YELLOW, Aspect_TOL_DASH, 1.0);
}
}
return myHiddenLineAspect;

View File

@@ -33,6 +33,7 @@
#include <OSD_Timer.hxx>
#include <ShapeAnalysis_ShapeTolerance.hxx>
#include <ShapeExtend_Explorer.hxx>
#include <ShapeProcess_ShapeContext.hxx>
#include <Standard_Type.hxx>
#include <StepBasic_ApplicationProtocolDefinition.hxx>
#include <StepBasic_HArray1OfProduct.hxx>
@@ -269,6 +270,34 @@ Handle(StepShape_NonManifoldSurfaceShapeRepresentation) STEPControl_ActorWrite::
return aResult;
}
//=======================================================================
//function : mergeInfoForNM
//purpose : bind already written shared faces to STEP entity for non-manifold
//=======================================================================
void STEPControl_ActorWrite::mergeInfoForNM(const Handle(Transfer_FinderProcess)& theFP,
const Handle(Standard_Transient) &theInfo) const
{
Handle(ShapeProcess_ShapeContext) aContext = Handle(ShapeProcess_ShapeContext)::DownCast ( theInfo );
if ( aContext.IsNull() ) return;
const TopTools_DataMapOfShapeShape &aMap = aContext->Map();
TopTools_DataMapIteratorOfDataMapOfShapeShape aShapeShapeIt(aMap);
for ( ; aShapeShapeIt.More(); aShapeShapeIt.Next() ) {
TopoDS_Shape anOrig = aShapeShapeIt.Key(), aRes = aShapeShapeIt.Value();
if (anOrig.ShapeType() != TopAbs_FACE)
continue;
Handle(TransferBRep_ShapeMapper) anOrigMapper= TransferBRep::ShapeMapper ( theFP, anOrig);
Handle(Transfer_Binder) anOrigBinder = theFP->Find ( anOrigMapper );
if (anOrigBinder.IsNull())
continue;
Handle(TransferBRep_ShapeMapper) aResMapper = TransferBRep::ShapeMapper ( theFP, aRes );
theFP->Bind(aResMapper, anOrigBinder);
}
}
//=======================================================================
//function : SetMode
@@ -867,16 +896,15 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
Handle(Standard_Transient) info;
Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val");
// Fix only manifold shapes, do nothing with non-manifold topology as it is processed separately (ssv; 13.11.2010)
TopoDS_Shape aShape;
if (isManifold)
aShape = XSAlgo::AlgoContainer()->ProcessShape(xShape, Tol, maxTol,
"write.step.resource.name",
"write.step.sequence", info,
FP->GetProgress() );
else
aShape = xShape;
aShape = XSAlgo::AlgoContainer()->ProcessShape(xShape, Tol, maxTol,
"write.step.resource.name",
"write.step.sequence", info,
FP->GetProgress() );
if (!isManifold) {
mergeInfoForNM(FP, info);
}
// create a STEP entity corresponding to shape
Handle(StepGeom_GeometricRepresentationItem) item;
switch (trmode)

View File

@@ -95,6 +95,9 @@ private:
//! to create a new one if doesn't exist yet)
//! (ssv; 13.11.2010)
Standard_EXPORT Handle(StepShape_NonManifoldSurfaceShapeRepresentation) getNMSSRForGroup (const Handle(TopTools_HSequenceOfShape)& shapeGroup, const Handle(Transfer_FinderProcess)& FP, Standard_Boolean& isNMSSRCreated) const;
//! bind already written shared faces to STEP entity for non-manifold
Standard_EXPORT void mergeInfoForNM(const Handle(Transfer_FinderProcess)& theFP, const Handle(Standard_Transient) &theInfo) const;
Standard_Integer mygroup;
Standard_Real mytoler;

View File

@@ -289,7 +289,7 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::Perform (Handle(Geom_Curv
}
GeomAdaptor_Curve aC3DAdaptor(c3d);
Standard_Real aMinParSpeed = Precision::Infinite(); // Minimal parameterization speed.
for(; anIdx <= bspl->NbKnots() && aFirstParam < Last; anIdx++)
{
// Fill current knot interval.
@@ -320,8 +320,12 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::Perform (Handle(Geom_Curv
{
Standard_Real aParam = aFirstParam + aStep * anIntIdx;
aC3DAdaptor.D0 (aParam, p3d2);
aLength3d += p3d2.Distance(p3d1);
const Standard_Real aDist = p3d2.Distance(p3d1);
aLength3d += aDist;
p3d1 = p3d2;
aMinParSpeed = Min(aMinParSpeed, aDist / aStep);
}
const Standard_Real aCoeff = aLength3d / (aLastParam - aFirstParam);
if (Abs(aCoeff) > gp::Resolution())
@@ -337,7 +341,8 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::Perform (Handle(Geom_Curv
}
const Standard_Real aMaxQuotientCoeff = 1500.0;
if (anEvenlyCoeff > aMaxQuotientCoeff)
if (anEvenlyCoeff > aMaxQuotientCoeff &&
aMinParSpeed > Precision::Confusion() )
{
PerformByProjLib(c3d, First, Last, c2d);
// PerformByProjLib fail detection:

View File

@@ -285,25 +285,26 @@ void StdPrs_DeflectionCurve::Add (const Handle (Prs3d_Presentation)& aPresentati
const Handle (Prs3d_Drawer)& aDrawer,
const Standard_Boolean theToDrawCurve)
{
Prs3d_Root::CurrentGroup(aPresentation)->SetPrimitivesAspect(aDrawer->LineAspect()->Aspect());
Handle(Graphic3d_Group) aGroup;
if (theToDrawCurve)
{
aGroup = Prs3d_Root::CurrentGroup(aPresentation);
aGroup->SetPrimitivesAspect (aDrawer->LineAspect()->Aspect());
}
Standard_Real V1, V2;
if (FindLimits(aCurve, aDrawer->MaximalParameterValue(), V1, V2))
{
TColgp_SequenceOfPnt Points;
Handle(Graphic3d_Group) aGroup;
if (theToDrawCurve)
{
aGroup = Prs3d_Root::CurrentGroup (aPresentation);
}
drawCurve(aCurve,
aGroup,
GetDeflection(aCurve, V1, V2, aDrawer),
aDrawer->DeviationAngle(),
V1, V2, Points);
if (aDrawer->LineArrowDraw()) {
if (aDrawer->LineArrowDraw()
&& !aGroup.IsNull())
{
gp_Pnt Location;
gp_Vec Direction;
aCurve.D1(V2, Location,Direction);
@@ -348,7 +349,9 @@ void StdPrs_DeflectionCurve::Add (const Handle (Prs3d_Presentation)& aPresentati
aDrawer->DeviationAngle(),
V1 , V2, Points);
if (aDrawer->LineArrowDraw()) {
if (aDrawer->LineArrowDraw()
&& !aGroup.IsNull())
{
gp_Pnt Location;
gp_Vec Direction;
aCurve.D1(V2, Location,Direction);

View File

@@ -18,12 +18,6 @@
#include <Adaptor3d_IsoCurve.hxx>
#include <BRepTools.hxx>
#include <BRep_Tool.hxx>
#include <ElCLib.hxx>
#include <ElSLib.hxx>
#include <GCE2d_MakeLine.hxx>
#include <gce_MakeLin2d.hxx>
#include <gce_MakePln.hxx>
#include <gce_MakeLin.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <GCPnts_QuasiUniformDeflection.hxx>
#include <Geom_BezierSurface.hxx>
@@ -32,67 +26,57 @@
#include <Geom_Line.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom2dInt_GInter.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <GeomAPI_IntCS.hxx>
#include <GeomLib.hxx>
#include <GeomLib_Tool.hxx>
#include <gp_Lin2d.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Hatch_Hatcher.hxx>
#include <IntRes2d_IntersectionPoint.hxx>
#include <NCollection_List.hxx>
#include <NCollection_QuickSort.hxx>
#include <ProjLib.hxx>
#include <NCollection_Shared.hxx>
#include <Prs3d.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_NListOfSequenceOfPnt.hxx>
#include <Prs3d_NListIteratorOfListOfSequenceOfPnt.hxx>
#include <Poly_Array1OfTriangle.hxx>
#include <Poly_Triangulation.hxx>
#include <StdPrs_DeflectionCurve.hxx>
#include <StdPrs_ToolRFace.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_SequenceOfPnt2d.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Geom_Surface.hxx>
typedef NCollection_Sequence<Handle(TColgp_HSequenceOfPnt)> Prs3d_NSequenceOfSequenceOfPnt;
#include <algorithm>
namespace
{
const gp_Lin2d isoU (const Standard_Real theU) { return gp_Lin2d (gp_Pnt2d (theU, 0.0), gp::DY2d()); }
const gp_Lin2d isoV (const Standard_Real theV) { return gp_Lin2d (gp_Pnt2d (0.0, theV), gp::DX2d()); }
//! Assembles array of primitives for sequence of polyine points.
//! @param thePoints [in] the polyline points.
//! @return array of primitives.
template <typename T>
inline Handle(T) primitivesForPolyline (const Prs3d_NSequenceOfSequenceOfPnt& thePoints)
{
if (thePoints.IsEmpty())
{
return Handle(T)();
}
typedef NCollection_Shared< NCollection_Vector<StdPrs_Isolines::SegOnIso> > VecOfSegments;
typedef NCollection_Sequence<Handle(VecOfSegments)> SeqOfVecOfSegments;
Standard_Integer aNbBounds = thePoints.Size();
Standard_Integer aNbVertices = 0;
for (Prs3d_NSequenceOfSequenceOfPnt::Iterator anIt (thePoints); anIt.More(); anIt.Next())
//! Pack isoline segments into polylines.
static void sortSegments (const SeqOfVecOfSegments& theSegments,
Prs3d_NListOfSequenceOfPnt& thePolylines)
{
for (SeqOfVecOfSegments::Iterator aLineIter (theSegments); aLineIter.More(); aLineIter.Next())
{
aNbVertices += anIt.Value()->Length();
}
Handle(T) aPrimitives = new T (aNbVertices, aNbBounds);
for (NCollection_Sequence<Handle(TColgp_HSequenceOfPnt)>::Iterator anIt (thePoints); anIt.More(); anIt.Next())
{
const Handle(TColgp_HSequenceOfPnt)& aPoints = anIt.Value();
aPrimitives->AddBound (aPoints->Length());
for (Standard_Integer anI = 1; anI <= aPoints->Length(); ++anI)
Handle(VecOfSegments)& anIsoSegs = aLineIter.ChangeValue();
std::stable_sort (anIsoSegs->begin(), anIsoSegs->end());
Handle(TColgp_HSequenceOfPnt) aPolyline = new TColgp_HSequenceOfPnt();
thePolylines.Append (aPolyline);
Standard_Real aLast = 0.0;
for (VecOfSegments::Iterator aSegIter (*anIsoSegs); aSegIter.More(); aSegIter.Next())
{
aPrimitives->AddVertex (aPoints->Value (anI));
if (!aPolyline->IsEmpty()
&& Abs (aSegIter.Value()[0].Param - aLast) > Precision::PConfusion())
{
aPolyline = new TColgp_HSequenceOfPnt();
thePolylines.Append (aPolyline);
}
aPolyline->Append (aSegIter.Value()[0].Pnt);
aPolyline->Append (aSegIter.Value()[1].Pnt);
aLast = aSegIter.Value()[1].Param;
}
}
return aPrimitives;
}
//! Reoder and adjust to the limit a curve's parameter values.
@@ -163,6 +147,21 @@ namespace
void StdPrs_Isolines::AddOnTriangulation (const Handle(Prs3d_Presentation)& thePresentation,
const TopoDS_Face& theFace,
const Handle(Prs3d_Drawer)& theDrawer)
{
Prs3d_NListOfSequenceOfPnt aUPolylines, aVPolylines;
AddOnTriangulation (theFace, theDrawer, aUPolylines, aVPolylines);
Prs3d::AddPrimitivesGroup (thePresentation, theDrawer->UIsoAspect(), aUPolylines);
Prs3d::AddPrimitivesGroup (thePresentation, theDrawer->VIsoAspect(), aVPolylines);
}
//==================================================================
// function : AddOnTriangulation
// purpose :
//==================================================================
void StdPrs_Isolines::AddOnTriangulation (const TopoDS_Face& theFace,
const Handle(Prs3d_Drawer)& theDrawer,
Prs3d_NListOfSequenceOfPnt& theUPolylines,
Prs3d_NListOfSequenceOfPnt& theVPolylines)
{
const Standard_Integer aNbIsoU = theDrawer->UIsoAspect()->Number();
const Standard_Integer aNbIsoV = theDrawer->VIsoAspect()->Number();
@@ -171,7 +170,7 @@ void StdPrs_Isolines::AddOnTriangulation (const Handle(Prs3d_Presentation)& theP
return;
}
// Evalute parameters for uv isolines.
// Evaluate parameters for uv isolines.
TColStd_SequenceOfReal aUIsoParams;
TColStd_SequenceOfReal aVIsoParams;
UVIsoParameters (theFace, aNbIsoU, aNbIsoV, theDrawer->MaximalParameterValue(), aUIsoParams, aVIsoParams);
@@ -195,13 +194,7 @@ void StdPrs_Isolines::AddOnTriangulation (const Handle(Prs3d_Presentation)& theP
aSurface->Transformed ((aLocSurface / aLocTriangulation).Transformation()));
}
AddOnTriangulation (thePresentation,
aTriangulation,
aSurface,
aLocTriangulation,
theDrawer,
aUIsoParams,
aVIsoParams);
addOnTriangulation (aTriangulation, aSurface, aLocTriangulation, aUIsoParams, aVIsoParams, theUPolylines, theVPolylines);
}
//==================================================================
@@ -215,12 +208,29 @@ void StdPrs_Isolines::AddOnTriangulation (const Handle(Prs3d_Presentation)& theP
const Handle(Prs3d_Drawer)& theDrawer,
const TColStd_SequenceOfReal& theUIsoParams,
const TColStd_SequenceOfReal& theVIsoParams)
{
Prs3d_NListOfSequenceOfPnt aUPolylines, aVPolylines;
addOnTriangulation (theTriangulation, theSurface, theLocation, theUIsoParams, theVIsoParams, aUPolylines, aVPolylines);
Prs3d::AddPrimitivesGroup (thePresentation, theDrawer->UIsoAspect(), aUPolylines);
Prs3d::AddPrimitivesGroup (thePresentation, theDrawer->VIsoAspect(), aVPolylines);
}
//==================================================================
// function : addOnTriangulation
// purpose :
//==================================================================
void StdPrs_Isolines::addOnTriangulation (const Handle(Poly_Triangulation)& theTriangulation,
const Handle(Geom_Surface)& theSurface,
const TopLoc_Location& theLocation,
const TColStd_SequenceOfReal& theUIsoParams,
const TColStd_SequenceOfReal& theVIsoParams,
Prs3d_NListOfSequenceOfPnt& theUPolylines,
Prs3d_NListOfSequenceOfPnt& theVPolylines)
{
const Standard_Integer aNbIsoU = theUIsoParams.Length();
const Standard_Integer aNbIsoV = theVIsoParams.Length();
Prs3d_NSequenceOfSequenceOfPnt aUPolylines;
Prs3d_NSequenceOfSequenceOfPnt aVPolylines;
SeqOfVecOfSegments aUPolylines, aVPolylines;
const Poly_Array1OfTriangle& aTriangles = theTriangulation->Triangles();
const TColgp_Array1OfPnt& aNodes = theTriangulation->Nodes();
@@ -245,66 +255,59 @@ void StdPrs_Isolines::AddOnTriangulation (const Handle(Prs3d_Presentation)& theP
// Evaluate polyline points for u isolines.
for (Standard_Integer anIsoIdx = 1; anIsoIdx <= aNbIsoU; ++anIsoIdx)
{
gp_Pnt aSegment[2];
SegOnIso aSegment;
const gp_Lin2d anIsolineUV = isoU (theUIsoParams.Value (anIsoIdx));
// Find intersections with triangle in uv space and its projection on triangulation.
if (!findSegmentOnTriangulation (theSurface, anIsolineUV, aNodesXYZ, aNodesUV, aSegment))
if (!findSegmentOnTriangulation (theSurface, true, anIsolineUV, aNodesXYZ, aNodesUV, aSegment))
{
continue;
}
if (aUIsoIndexes.Value (anIsoIdx) == -1)
{
aUPolylines.Append (new TColgp_HSequenceOfPnt());
aUPolylines.Append (new VecOfSegments());
aUIsoIndexes.SetValue (anIsoIdx, aUPolylines.Size());
}
Handle(TColgp_HSequenceOfPnt) anIsoPnts = aUPolylines.ChangeValue (aUIsoIndexes.Value (anIsoIdx));
anIsoPnts->Append (theLocation.IsIdentity() ? aSegment[0] : aSegment[0].Transformed (theLocation));
anIsoPnts->Append (theLocation.IsIdentity() ? aSegment[1] : aSegment[1].Transformed (theLocation));
Handle(VecOfSegments) anIsoPnts = aUPolylines.ChangeValue (aUIsoIndexes.Value (anIsoIdx));
if (!theLocation.IsIdentity())
{
aSegment[0].Pnt.Transform (theLocation);
aSegment[1].Pnt.Transform (theLocation);
}
anIsoPnts->Append (aSegment);
}
// Evaluate polyline points for v isolines.
for (Standard_Integer anIsoIdx = 1; anIsoIdx <= aNbIsoV; ++anIsoIdx)
{
gp_Pnt aSegment[2];
SegOnIso aSegment;
const gp_Lin2d anIsolineUV = isoV (theVIsoParams.Value (anIsoIdx));
if (!findSegmentOnTriangulation (theSurface, anIsolineUV, aNodesXYZ, aNodesUV, aSegment))
if (!findSegmentOnTriangulation (theSurface, false, anIsolineUV, aNodesXYZ, aNodesUV, aSegment))
{
continue;
}
if (aVIsoIndexes.Value (anIsoIdx) == -1)
{
aVPolylines.Append (new TColgp_HSequenceOfPnt());
aVPolylines.Append (new VecOfSegments());
aVIsoIndexes.SetValue (anIsoIdx, aVPolylines.Size());
}
Handle(TColgp_HSequenceOfPnt) anIsoPnts = aVPolylines.ChangeValue (aVIsoIndexes.Value (anIsoIdx));
anIsoPnts->Append (theLocation.IsIdentity() ? aSegment[0] : aSegment[0].Transformed (theLocation));
anIsoPnts->Append (theLocation.IsIdentity() ? aSegment[1] : aSegment[1].Transformed (theLocation));
Handle(VecOfSegments) anIsoPnts = aVPolylines.ChangeValue (aVIsoIndexes.Value (anIsoIdx));
if (!theLocation.IsIdentity())
{
aSegment[0].Pnt.Transform (theLocation);
aSegment[1].Pnt.Transform (theLocation);
}
anIsoPnts->Append (aSegment);
}
}
// Add primitive arrays for isoline segments.
Handle(Graphic3d_ArrayOfSegments) aUPrimitives = primitivesForPolyline<Graphic3d_ArrayOfSegments> (aUPolylines);
Handle(Graphic3d_ArrayOfSegments) aVPrimitives = primitivesForPolyline<Graphic3d_ArrayOfSegments> (aVPolylines);
if (!aUPrimitives.IsNull())
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
aGroup->SetPrimitivesAspect (theDrawer->UIsoAspect()->Aspect());
aGroup->AddPrimitiveArray (aUPrimitives);
}
if (!aVPrimitives.IsNull())
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
aGroup->SetPrimitivesAspect (theDrawer->VIsoAspect()->Aspect());
aGroup->AddPrimitiveArray (aVPrimitives);
}
sortSegments (aUPolylines, theUPolylines);
sortSegments (aVPolylines, theVPolylines);
}
//==================================================================
@@ -315,6 +318,22 @@ void StdPrs_Isolines::AddOnSurface (const Handle(Prs3d_Presentation)& thePresent
const TopoDS_Face& theFace,
const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theDeflection)
{
Prs3d_NListOfSequenceOfPnt aUPolylines, aVPolylines;
AddOnSurface (theFace, theDrawer, theDeflection, aUPolylines, aVPolylines);
Prs3d::AddPrimitivesGroup (thePresentation, theDrawer->UIsoAspect(), aUPolylines);
Prs3d::AddPrimitivesGroup (thePresentation, theDrawer->VIsoAspect(), aVPolylines);
}
//==================================================================
// function : AddOnSurface
// purpose :
//==================================================================
void StdPrs_Isolines::AddOnSurface (const TopoDS_Face& theFace,
const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theDeflection,
Prs3d_NListOfSequenceOfPnt& theUPolylines,
Prs3d_NListOfSequenceOfPnt& theVPolylines)
{
const Standard_Integer aNbIsoU = theDrawer->UIsoAspect()->Number();
const Standard_Integer aNbIsoV = theDrawer->VIsoAspect()->Number();
@@ -323,18 +342,18 @@ void StdPrs_Isolines::AddOnSurface (const Handle(Prs3d_Presentation)& thePresent
return;
}
// Evalute parameters for uv isolines.
TColStd_SequenceOfReal aUIsoParams;
TColStd_SequenceOfReal aVIsoParams;
// Evaluate parameters for uv isolines.
TColStd_SequenceOfReal aUIsoParams, aVIsoParams;
UVIsoParameters (theFace, aNbIsoU, aNbIsoV, theDrawer->MaximalParameterValue(), aUIsoParams, aVIsoParams);
BRepAdaptor_Surface aSurface (theFace);
AddOnSurface (thePresentation,
new BRepAdaptor_HSurface (aSurface),
addOnSurface (new BRepAdaptor_HSurface (aSurface),
theDrawer,
theDeflection,
aUIsoParams,
aVIsoParams);
aVIsoParams,
theUPolylines,
theVPolylines);
}
//==================================================================
@@ -347,6 +366,24 @@ void StdPrs_Isolines::AddOnSurface (const Handle(Prs3d_Presentation)& thePrese
const Standard_Real theDeflection,
const TColStd_SequenceOfReal& theUIsoParams,
const TColStd_SequenceOfReal& theVIsoParams)
{
Prs3d_NListOfSequenceOfPnt aUPolylines, aVPolylines;
addOnSurface (theSurface, theDrawer, theDeflection, theUIsoParams, theVIsoParams, aUPolylines, aVPolylines);
Prs3d::AddPrimitivesGroup (thePresentation, theDrawer->UIsoAspect(), aUPolylines);
Prs3d::AddPrimitivesGroup (thePresentation, theDrawer->VIsoAspect(), aVPolylines);
}
//==================================================================
// function : addOnSurface
// purpose :
//==================================================================
void StdPrs_Isolines::addOnSurface (const Handle(BRepAdaptor_HSurface)& theSurface,
const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theDeflection,
const TColStd_SequenceOfReal& theUIsoParams,
const TColStd_SequenceOfReal& theVIsoParams,
Prs3d_NListOfSequenceOfPnt& theUPolylines,
Prs3d_NListOfSequenceOfPnt& theVPolylines)
{
// Choose a deflection for sampling edge uv curves.
Standard_Real aUVLimit = theDrawer->MaximalParameterValue();
@@ -356,8 +393,6 @@ void StdPrs_Isolines::AddOnSurface (const Handle(Prs3d_Presentation)& thePrese
Standard_Real aVmax = Min (theSurface->LastVParameter(), aUVLimit);
Standard_Real aSamplerDeflection = Max (aUmax - aUmin, aVmax - aVmin) * theDrawer->DeviationCoefficient();
Standard_Real aHatchingTolerance = RealLast();
Prs3d_NSequenceOfSequenceOfPnt aUPolylines;
Prs3d_NSequenceOfSequenceOfPnt aVPolylines;
try
{
@@ -522,7 +557,7 @@ void StdPrs_Isolines::AddOnSurface (const Handle(Prs3d_Presentation)& thePrese
: (Adaptor3d_Curve*) &aBSurfaceCurve;
Handle(TColgp_HSequenceOfPnt) aPoints = new TColgp_HSequenceOfPnt();
StdPrs_DeflectionCurve::Add (thePresentation,
StdPrs_DeflectionCurve::Add (Handle(Prs3d_Presentation)(),
*aCurve,
aSegmentP1,
aSegmentP2,
@@ -537,11 +572,11 @@ void StdPrs_Isolines::AddOnSurface (const Handle(Prs3d_Presentation)& thePrese
if (isIsoU)
{
aUPolylines.Append (aPoints);
theUPolylines.Append (aPoints);
}
else
{
aVPolylines.Append (aPoints);
theVPolylines.Append (aPoints);
}
}
}
@@ -550,24 +585,6 @@ void StdPrs_Isolines::AddOnSurface (const Handle(Prs3d_Presentation)& thePrese
{
// ...
}
// Add primitive arrays for isoline segments.
Handle(Graphic3d_ArrayOfPolylines) aUPrimitives = primitivesForPolyline<Graphic3d_ArrayOfPolylines> (aUPolylines);
Handle(Graphic3d_ArrayOfPolylines) aVPrimitives = primitivesForPolyline<Graphic3d_ArrayOfPolylines> (aVPolylines);
if (!aUPrimitives.IsNull())
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
aGroup->SetPrimitivesAspect (theDrawer->UIsoAspect()->Aspect());
aGroup->AddPrimitiveArray (aUPrimitives);
}
if (!aVPrimitives.IsNull())
{
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
aGroup->SetPrimitivesAspect (theDrawer->VIsoAspect()->Aspect());
aGroup->AddPrimitiveArray (aVPrimitives);
}
}
//==================================================================
@@ -630,10 +647,11 @@ void StdPrs_Isolines::UVIsoParameters (const TopoDS_Face& theFace,
// purpose :
//==================================================================
Standard_Boolean StdPrs_Isolines::findSegmentOnTriangulation (const Handle(Geom_Surface)& theSurface,
const bool theIsU,
const gp_Lin2d& theIsoline,
const gp_Pnt* theNodesXYZ,
const gp_Pnt2d* theNodesUV,
gp_Pnt* theSegment)
SegOnIso& theSegment)
{
Standard_Integer aNPoints = 0;
@@ -660,15 +678,20 @@ Standard_Boolean StdPrs_Isolines::findSegmentOnTriangulation (const Handle(Geom_
// Isoline crosses first point of an edge.
if (Abs (aDistanceUV1) < Precision::PConfusion())
{
theSegment[aNPoints++] = aNode1;
theSegment[aNPoints].Param = theIsU ? aNodeUV1.Y() : aNodeUV1.X();
theSegment[aNPoints].Pnt = aNode1;
++aNPoints;
continue;
}
// Isoline crosses second point of an edge.
if (Abs (aDistanceUV2) < Precision::PConfusion())
{
theSegment[aNPoints++] = aNode2;
aLinkIter++;
theSegment[aNPoints].Param = theIsU ? aNodeUV2.Y() : aNodeUV2.X();
theSegment[aNPoints].Pnt = aNode2;
++aNPoints;
++aLinkIter;
continue;
}
@@ -681,7 +704,9 @@ Standard_Boolean StdPrs_Isolines::findSegmentOnTriangulation (const Handle(Geom_
// Isoline crosses degenerated link.
if (aNode1.SquareDistance (aNode2) < Precision::PConfusion())
{
theSegment[aNPoints++] = aNode1;
theSegment[aNPoints].Param = theIsU ? aNodeUV1.Y() : aNodeUV1.X();
theSegment[aNPoints].Pnt = aNode1;
++aNPoints;
continue;
}
@@ -692,12 +717,12 @@ Standard_Boolean StdPrs_Isolines::findSegmentOnTriangulation (const Handle(Geom_
Standard_Real anAlpha = Abs (aDistanceUV1) / (Abs (aDistanceUV1) + Abs (aDistanceUV2));
gp_Pnt aCross (0.0, 0.0, 0.0);
// Is surface definition available?
Standard_Real aCrossU = aNodeUV1.X() + anAlpha * (aNodeUV2.X() - aNodeUV1.X());
Standard_Real aCrossV = aNodeUV1.Y() + anAlpha * (aNodeUV2.Y() - aNodeUV1.Y());
Standard_Real aCrossParam = theIsU ? aCrossV : aCrossU;
if (theSurface.IsNull())
{
// Do linear interpolation of point coordinates using
// triangulation nodes.
// Do linear interpolation of point coordinates using triangulation nodes.
aCross.SetX (aNode1.X() + anAlpha * (aNode2.X() - aNode1.X()));
aCross.SetY (aNode1.Y() + anAlpha * (aNode2.Y() - aNode1.Y()));
aCross.SetZ (aNode1.Z() + anAlpha * (aNode2.Z() - aNode1.Z()));
@@ -705,9 +730,6 @@ Standard_Boolean StdPrs_Isolines::findSegmentOnTriangulation (const Handle(Geom_
else
{
// Do linear interpolation of point coordinates by triangulation nodes.
Standard_Real aCrossU = aNodeUV1.X() + anAlpha * (aNodeUV2.X() - aNodeUV1.X());
Standard_Real aCrossV = aNodeUV1.Y() + anAlpha * (aNodeUV2.Y() - aNodeUV1.Y());
// Get 3d point on surface.
Handle(Geom_Curve) anIso1, anIso2, anIso3;
Standard_Real aPntOnNode1Iso = 0.0;
@@ -740,15 +762,29 @@ Standard_Boolean StdPrs_Isolines::findSegmentOnTriangulation (const Handle(Geom_
Standard_Real aLength2 = GCPnts_AbscissaPoint::Length (aCurveAdaptor2, aPntOnNode2Iso, aPntOnNode3Iso, 1e-2);
if (Abs (aLength1) < Precision::Confusion() || Abs (aLength2) < Precision::Confusion())
{
theSegment[aNPoints++] = (aNode2.XYZ() - aNode1.XYZ()) * anAlpha + aNode1.XYZ();
theSegment[aNPoints].Param = aCrossParam;
theSegment[aNPoints].Pnt = (aNode2.XYZ() - aNode1.XYZ()) * anAlpha + aNode1.XYZ();
++aNPoints;
continue;
}
aCross = (aNode2.XYZ() - aNode1.XYZ()) * (aLength1 / (aLength1 + aLength2)) + aNode1.XYZ();
}
theSegment[aNPoints++] = aCross;
theSegment[aNPoints].Param = aCrossParam;
theSegment[aNPoints].Pnt = aCross;
++aNPoints;
}
return aNPoints == 2;
if (aNPoints != 2
|| Abs (theSegment[1].Param - theSegment[0].Param) <= Precision::PConfusion())
{
return false;
}
if (theSegment[1].Param < theSegment[0].Param)
{
std::swap (theSegment[0], theSegment[1]);
}
return true;
}

View File

@@ -24,6 +24,7 @@
#include <Prs3d_Root.hxx>
#include <Prs3d_NListOfSequenceOfPnt.hxx>
#include <Poly_Triangulation.hxx>
#include <StdPrs_DeflectionCurve.hxx>
#include <StdPrs_ToolTriangulatedShape.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
@@ -65,6 +66,29 @@ public:
}
}
//! Computes isolines presentation for a TopoDS face.
//! This method chooses proper version of isoline builder algorithm : on triangulation
//! or surface depending on the flag passed from Prs3d_Drawer attributes.
//! This method is a default way to display isolines for a given TopoDS face.
//! @param theFace [in] the face.
//! @param theDrawer [in] the display settings.
//! @param theDeflection [in] the deflection for isolines-on-surface version.
static void Add (const TopoDS_Face& theFace,
const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theDeflection,
Prs3d_NListOfSequenceOfPnt& theUPolylines,
Prs3d_NListOfSequenceOfPnt& theVPolylines)
{
if (theDrawer->IsoOnTriangulation() && StdPrs_ToolTriangulatedShape::IsTriangulated (theFace))
{
AddOnTriangulation (theFace, theDrawer, theUPolylines, theVPolylines);
}
else
{
AddOnSurface (theFace, theDrawer, theDeflection, theUPolylines, theVPolylines);
}
}
//! Computes isolines on triangulation and adds them to a presentation.
//! @param thePresentation [in] the presentation.
//! @param theFace [in] the face.
@@ -73,6 +97,16 @@ public:
const TopoDS_Face& theFace,
const Handle(Prs3d_Drawer)& theDrawer);
//! Computes isolines on triangulation.
//! @param theFace [in] the face.
//! @param theDrawer [in] the display settings.
//! @param theUPolylines [out] the sequence of result polylines
//! @param theVPolylines [out] the sequence of result polylines
Standard_EXPORT static void AddOnTriangulation (const TopoDS_Face& theFace,
const Handle(Prs3d_Drawer)& theDrawer,
Prs3d_NListOfSequenceOfPnt& theUPolylines,
Prs3d_NListOfSequenceOfPnt& theVPolylines);
//! Computes isolines on triangulation and adds them to a presentation.
//! @param thePresentation [in] the presentation.
//! @param theTriangulation [in] the triangulation.
@@ -103,6 +137,18 @@ public:
const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theDeflection);
//! Computes isolines on surface and adds them to presentation.
//! @param theFace [in] the face
//! @param theDrawer [in] the display settings
//! @param theDeflection [in] the deflection value
//! @param theUPolylines [out] the sequence of result polylines
//! @param theVPolylines [out] the sequence of result polylines
Standard_EXPORT static void AddOnSurface (const TopoDS_Face& theFace,
const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theDeflection,
Prs3d_NListOfSequenceOfPnt& theUPolylines,
Prs3d_NListOfSequenceOfPnt& theVPolylines);
//! Computes isolines on surface and adds them to presentation.
//! @param thePresentation [in] the presentation.
//! @param theSurface [in] the surface.
@@ -131,20 +177,87 @@ public:
TColStd_SequenceOfReal& theUIsoParams,
TColStd_SequenceOfReal& theVIsoParams);
public:
//! Auxiliary structure defining 3D point on isoline.
struct PntOnIso
{
gp_Pnt Pnt; //!< 3D point
double Param; //!< parameter along the line (for sorting)
};
//! Auxiliary structure defining segment of isoline.
struct SegOnIso
{
PntOnIso Pnts[2];
operator PntOnIso*() { return Pnts; }
operator const PntOnIso*() const { return Pnts; }
bool operator< (const SegOnIso& theOther) const
{
return Pnts[1].Param < theOther.Pnts[0].Param;
}
};
private:
//! Computes isolines on surface.
//! @param theSurface [in] the surface
//! @param theDrawer [in] the display settings
//! @param theDeflection [in] the deflection value
//! @param theUIsoParams [in] the parameters of u isolines to compute
//! @param theVIsoParams [in] the parameters of v isolines to compute
//! @param theUPolylines [out] the sequence of result polylines
//! @param theVPolylines [out] the sequence of result polylines
Standard_EXPORT static void addOnSurface (const Handle(BRepAdaptor_HSurface)& theSurface,
const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theDeflection,
const TColStd_SequenceOfReal& theUIsoParams,
const TColStd_SequenceOfReal& theVIsoParams,
Prs3d_NListOfSequenceOfPnt& theUPolylines,
Prs3d_NListOfSequenceOfPnt& theVPolylines);
//! Computes isolines on triangulation.
//! @param thePresentation [in] the presentation
//! @param theTriangulation [in] the triangulation
//! @param theSurface [in] the definition of triangulated surface. The surface
//! adapter is used to precisely evaluate isoline points using surface
//! law and fit them on triangulation. If NULL is passed, the method will
//! use linear interpolation of triangle node's UV coordinates to evaluate
//! isoline points
//! @param theLocation [in] the location transformation defined for triangulation (surface)
//! @param theDrawer [in] the display settings
//! @param theUIsoParams [in] the parameters of u isolines to compute
//! @param theVIsoParams [in] the parameters of v isolines to compute
//! @param theUPolylines [out] the sequence of result polylines
//! @param theVPolylines [out] the sequence of result polylines
Standard_EXPORT static void addOnTriangulation (const Handle(Poly_Triangulation)& theTriangulation,
const Handle(Geom_Surface)& theSurface,
const TopLoc_Location& theLocation,
const TColStd_SequenceOfReal& theUIsoParams,
const TColStd_SequenceOfReal& theVIsoParams,
Prs3d_NListOfSequenceOfPnt& theUPolylines,
Prs3d_NListOfSequenceOfPnt& theVPolylines);
//! Find isoline segment on a triangle.
//! @param theSurface [in] the surface.
//! @param theIsU [in] when true than U isoline is specified, V isoline otherwise
//! @param theIsoline [in] the isoline in uv coordinates.
//! @param theNodesXYZ [in] the XYZ coordinates of triangle nodes.
//! @param theNodesUV [in] the UV coordinates of triangle nodes.
//! @param theSegment [out] the XYZ points of crossed triangle's links.
//! with U cross point parameter for V isoline
//! or V parameters for U isoline (depending on theIsU)
//! @return TRUE if the isoline passes through the triangle.
Standard_EXPORT static Standard_Boolean findSegmentOnTriangulation (const Handle(Geom_Surface)& theSurface,
const bool theIsU,
const gp_Lin2d& theIsoline,
const gp_Pnt* theNodesXYZ,
const gp_Pnt2d* theNodesUV,
gp_Pnt* theSegment);
SegOnIso& theSegment);
};
#endif // _StdPrs_Isolines_H__

View File

@@ -309,110 +309,96 @@ namespace
// for computing boundaries presentation
NCollection_List<Handle(TColgp_HArray1OfPnt)> aNodeCollection;
Standard_Integer aNodeNumber = 0;
Standard_Integer aNbPolylines = 0;
TopLoc_Location aTrsf;
// explore all boundary edges
TopTools_IndexedDataMapOfShapeListOfShape anEdgesMap;
TopExp::MapShapesAndAncestors (
theShape, TopAbs_EDGE, TopAbs_FACE, anEdgesMap);
Standard_Integer anEdgeIdx = 1;
for ( ; anEdgeIdx <= anEdgesMap.Extent (); anEdgeIdx++)
TopExp::MapShapesAndAncestors (theShape, TopAbs_EDGE, TopAbs_FACE, anEdgesMap);
for (TopTools_IndexedDataMapOfShapeListOfShape::Iterator anEdgeIter (anEdgesMap); anEdgeIter.More(); anEdgeIter.Next())
{
// reject free edges
const TopTools_ListOfShape& aFaceList = anEdgesMap.FindFromIndex (anEdgeIdx);
if (aFaceList.Extent() == 0)
continue;
// take one of the shared edges and get edge triangulation
const TopoDS_Face& aFace = TopoDS::Face (aFaceList.First ());
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgesMap.FindKey (anEdgeIdx));
Handle(Poly_Triangulation) aTriangulation =
BRep_Tool::Triangulation (aFace, aTrsf);
if (aTriangulation.IsNull ())
continue;
Handle(Poly_PolygonOnTriangulation) anEdgePoly =
BRep_Tool::PolygonOnTriangulation (anEdge, aTriangulation, aTrsf);
if (anEdgePoly.IsNull ())
continue;
// get edge nodes indexes from face triangulation
const TColgp_Array1OfPnt& aTriNodes = aTriangulation->Nodes ();
const TColStd_Array1OfInteger& anEdgeNodes = anEdgePoly->Nodes ();
if (anEdgeNodes.Length () < 2)
continue;
// collect the edge nodes
Handle(TColgp_HArray1OfPnt) aCollected =
new TColgp_HArray1OfPnt (anEdgeNodes.Lower (), anEdgeNodes.Upper ());
Standard_Integer aNodeIdx = anEdgeNodes.Lower ();
for ( ; aNodeIdx <= anEdgeNodes.Upper (); aNodeIdx++)
if (anEdgeIter.Value().Extent() == 0)
{
// node index in face triangulation
Standard_Integer aTriIndex = anEdgeNodes.Value (aNodeIdx);
// get node and apply location transformation to the node
gp_Pnt aTriNode = aTriNodes.Value (aTriIndex);
if (!aTrsf.IsIdentity ())
aTriNode.Transform (aTrsf);
// add node to the boundary array
aCollected->SetValue (aNodeIdx, aTriNode);
continue;
}
aNodeNumber += anEdgeNodes.Length ();
aNodeCollection.Append (aCollected);
// take one of the shared edges and get edge triangulation
const TopoDS_Face& aFace = TopoDS::Face (anEdgeIter.Value().First());
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (aFace, aTrsf);
if (aTriangulation.IsNull())
{
continue;
}
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeIter.Key());
Handle(Poly_PolygonOnTriangulation) anEdgePoly = BRep_Tool::PolygonOnTriangulation (anEdge, aTriangulation, aTrsf);
if (!anEdgePoly.IsNull()
&& anEdgePoly->Nodes().Length() >= 2)
{
aNodeNumber += anEdgePoly->Nodes().Length();
++aNbPolylines;
}
}
if (aNodeNumber == 0)
{
return;
}
// check if it possible to continue building the presentation
if (aNodeNumber == 0)
return;
// allocate polyline array for presentation
Standard_Integer aSegmentEdgeNb =
(aNodeNumber - aNodeCollection.Extent()) * 2;
Handle(Graphic3d_ArrayOfSegments) aSegments =
new Graphic3d_ArrayOfSegments (aNodeNumber, aSegmentEdgeNb);
// build presentation for edge bondaries
NCollection_List<Handle(TColgp_HArray1OfPnt)>::Iterator
aCollIt (aNodeCollection);
// the edge index is increased in each iteration step to
// avoid contiguous segments between different face edges.
for ( ; aCollIt.More(); aCollIt.Next () )
// create indexed segments array to pack polylines from different edges into single array
const Standard_Integer aSegmentEdgeNb = (aNodeNumber - aNbPolylines) * 2;
Handle(Graphic3d_ArrayOfSegments) aSegments = new Graphic3d_ArrayOfSegments (aNodeNumber, aSegmentEdgeNb);
for (TopTools_IndexedDataMapOfShapeListOfShape::Iterator anEdgeIter (anEdgesMap); anEdgeIter.More(); anEdgeIter.Next())
{
const Handle(TColgp_HArray1OfPnt)& aNodeArray = aCollIt.Value ();
Standard_Integer aNodeIdx = aNodeArray->Lower ();
// add first node (this node is not shared with previous segment).
// for each face edge, indices for sharing nodes
// between segments begin from the first added node.
Standard_Integer aSegmentEdge =
aSegments->AddVertex (aNodeArray->Value (aNodeIdx));
// add subsequent nodes and provide edge indexes for sharing
// the nodes between the sequential segments.
for ( aNodeIdx++; aNodeIdx <= aNodeArray->Upper (); aNodeIdx++ )
if (anEdgeIter.Value().Extent() == 0)
{
aSegments->AddVertex (aNodeArray->Value (aNodeIdx));
aSegments->AddEdge ( aSegmentEdge);
aSegments->AddEdge (++aSegmentEdge);
continue;
}
const TopoDS_Face& aFace = TopoDS::Face (anEdgeIter.Value().First());
Handle(Poly_Triangulation) aTriangulation = BRep_Tool::Triangulation (aFace, aTrsf);
if (aTriangulation.IsNull())
{
continue;
}
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeIter.Key());
Handle(Poly_PolygonOnTriangulation) anEdgePoly = BRep_Tool::PolygonOnTriangulation (anEdge, aTriangulation, aTrsf);
if (anEdgePoly.IsNull()
|| anEdgePoly->Nodes().Length () < 2)
{
continue;
}
// get edge nodes indexes from face triangulation
const TColgp_Array1OfPnt& aTriNodes = aTriangulation->Nodes();
const TColStd_Array1OfInteger& anEdgeNodes = anEdgePoly->Nodes();
// collect the edge nodes
Standard_Integer aSegmentEdge = aSegments->VertexNumber() + 1;
for (Standard_Integer aNodeIdx = anEdgeNodes.Lower(); aNodeIdx <= anEdgeNodes.Upper(); ++aNodeIdx)
{
// node index in face triangulation
// get node and apply location transformation to the node
const Standard_Integer aTriIndex = anEdgeNodes.Value (aNodeIdx);
gp_Pnt aTriNode = aTriNodes.Value (aTriIndex);
if (!aTrsf.IsIdentity())
{
aTriNode.Transform (aTrsf);
}
aSegments->AddVertex (aTriNode);
if (aNodeIdx != anEdgeNodes.Lower())
{
aSegments->AddEdge ( aSegmentEdge);
aSegments->AddEdge (++aSegmentEdge);
}
}
}
// set up aspect and add polyline data
Handle(Graphic3d_AspectLine3d) aBoundaryAspect =
theDrawer->FaceBoundaryAspect ()->Aspect ();
Handle(Graphic3d_AspectLine3d) aBoundaryAspect = theDrawer->FaceBoundaryAspect()->Aspect();
Handle(Graphic3d_Group) aPrsGrp = Prs3d_Root::CurrentGroup (thePrs);
aPrsGrp->SetGroupPrimitivesAspect (aBoundaryAspect);

View File

@@ -25,15 +25,12 @@
#include <Standard_ErrorHandler.hxx>
#include <Prs3d_ShapeTool.hxx>
#include <Prs3d_IsoAspect.hxx>
#include <Prs3d_NListOfSequenceOfPnt.hxx>
#include <Prs3d_NListIteratorOfListOfSequenceOfPnt.hxx>
#include <Prs3d.hxx>
#include <Poly_Connect.hxx>
#include <Poly_PolygonOnTriangulation.hxx>
#include <Poly_Polygon3D.hxx>
#include <Poly_Triangulation.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
#include <Graphic3d_ArrayOfSegments.hxx>
#include <Graphic3d_ArrayOfPoints.hxx>
#include <gp_Pnt.hxx>
@@ -43,12 +40,6 @@
#include <TopoDS_Face.hxx>
#include <TopoDS.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <NCollection_List.hxx>
namespace
{
typedef NCollection_List<Handle(TColgp_HSequenceOfPnt)> ListOfSequenceOfPnt;
}
// =========================================================================
// function : Add
@@ -78,54 +69,106 @@ void StdPrs_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
}
}
TColgp_SequenceOfPnt aShapeVertices;
for (aTool.InitVertex(); aTool.MoreVertex(); aTool.NextVertex())
{
aShapeVertices.Append (BRep_Tool::Pnt (aTool.GetVertex()));
}
Standard_Real aShapeDeflection = Prs3d::GetDeflection (theShape, theDrawer);
// Draw shape elements.
TopTools_ListOfShape aDiscreteFaces;
for (aTool.InitFace(); aTool.MoreFace(); aTool.NextFace())
// Draw shape elements
{
if (!aTool.HasSurface())
TopTools_ListOfShape aDiscreteFaces;
for (aTool.InitFace(); aTool.MoreFace(); aTool.NextFace())
{
aDiscreteFaces.Append (aTool.GetFace());
if (!aTool.HasSurface())
{
aDiscreteFaces.Append (aTool.GetFace());
}
}
addEdgesOnTriangulation (thePresentation, aDiscreteFaces, theDrawer->FreeBoundaryAspect());
}
Prs3d_NListOfSequenceOfPnt aCommonPolylines;
const Handle(Prs3d_LineAspect)& aWireAspect = theDrawer->WireAspect();
// Draw isolines
{
Prs3d_NListOfSequenceOfPnt aUPolylines, aVPolylines;
Prs3d_NListOfSequenceOfPnt* aUPolylinesPtr = &aUPolylines;
Prs3d_NListOfSequenceOfPnt* aVPolylinesPtr = &aVPolylines;
const Handle(Prs3d_LineAspect)& anIsoAspectU = theDrawer->UIsoAspect();
const Handle(Prs3d_LineAspect)& anIsoAspectV = theDrawer->VIsoAspect();
if (anIsoAspectV->Aspect()->IsEqual (*anIsoAspectU->Aspect()))
{
aVPolylinesPtr = aUPolylinesPtr;
}
if (anIsoAspectU->Aspect()->IsEqual (*aWireAspect->Aspect()))
{
aUPolylinesPtr = &aCommonPolylines;
}
if (anIsoAspectV->Aspect()->IsEqual (*aWireAspect->Aspect()))
{
aVPolylinesPtr = &aCommonPolylines;
}
for (aTool.InitFace(); aTool.MoreFace(); aTool.NextFace())
{
if (aTool.IsPlanarFace() && !theDrawer->IsoOnPlane())
{
continue;
}
StdPrs_Isolines::Add (aTool.GetFace(), theDrawer, aShapeDeflection, *aUPolylinesPtr, *aVPolylinesPtr);
}
Prs3d::AddPrimitivesGroup (thePresentation, anIsoAspectU, aUPolylines);
Prs3d::AddPrimitivesGroup (thePresentation, anIsoAspectV, aVPolylines);
}
addEdgesOnTriangulation (thePresentation, aDiscreteFaces, theDrawer->FreeBoundaryAspect());
if (!aLWire.IsEmpty() && theDrawer->WireDraw())
{
addEdges (thePresentation, aLWire, theDrawer->WireAspect(), theDrawer, aShapeDeflection);
}
if (!aLFree.IsEmpty() && theDrawer->FreeBoundaryDraw())
{
addEdges (thePresentation, aLFree, theDrawer->FreeBoundaryAspect(), theDrawer, aShapeDeflection);
addEdges (aLWire, theDrawer, aShapeDeflection, aCommonPolylines);
}
if (!aLUnFree.IsEmpty() && theDrawer->UnFreeBoundaryDraw())
{
addEdges (thePresentation, aLUnFree, theDrawer->UnFreeBoundaryAspect(), theDrawer, aShapeDeflection);
}
if (!aShapeVertices.IsEmpty())
{
addVertices (thePresentation, aShapeVertices, theDrawer->PointAspect());
}
// Draw isolines.
for (aTool.InitFace(); aTool.MoreFace(); aTool.NextFace())
{
if (aTool.IsPlanarFace() && !theDrawer->IsoOnPlane())
const Handle(Prs3d_LineAspect)& aLineAspect = theDrawer->UnFreeBoundaryAspect();
if (!aLineAspect->Aspect()->IsEqual (*aWireAspect->Aspect()))
{
continue;
Prs3d_NListOfSequenceOfPnt aPolylines;
addEdges (aLUnFree, theDrawer, aShapeDeflection, aPolylines);
Prs3d::AddPrimitivesGroup (thePresentation, aLineAspect, aPolylines);
}
else
{
addEdges (aLUnFree, theDrawer, aShapeDeflection, aCommonPolylines);
}
}
StdPrs_Isolines::Add (thePresentation, aTool.GetFace(), theDrawer, aShapeDeflection);
if (!aLFree.IsEmpty() && theDrawer->FreeBoundaryDraw())
{
const Handle(Prs3d_LineAspect)& aLineAspect = theDrawer->FreeBoundaryAspect();
if (!aLineAspect->Aspect()->IsEqual (*aWireAspect->Aspect()))
{
Prs3d_NListOfSequenceOfPnt aPolylines;
addEdges (aLFree, theDrawer, aShapeDeflection, aPolylines);
Prs3d::AddPrimitivesGroup (thePresentation, aLineAspect, aPolylines);
}
else
{
addEdges (aLFree, theDrawer, aShapeDeflection, aCommonPolylines);
}
}
Prs3d::AddPrimitivesGroup (thePresentation, theDrawer->WireAspect(), aCommonPolylines);
{
TColgp_SequenceOfPnt aShapeVertices;
for (aTool.InitVertex(); aTool.MoreVertex(); aTool.NextVertex())
{
aShapeVertices.Append (BRep_Tool::Pnt (aTool.GetVertex()));
}
if (!aShapeVertices.IsEmpty())
{
addVertices (thePresentation, aShapeVertices, theDrawer->PointAspect());
}
}
}
@@ -133,14 +176,11 @@ void StdPrs_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
// function : AddEdges
// purpose :
// =========================================================================
void StdPrs_WFShape::addEdges (const Handle (Prs3d_Presentation)& thePresentation,
const TopTools_ListOfShape& theEdges,
const Handle (Prs3d_LineAspect)& theAspect,
const Handle (Prs3d_Drawer)& theDrawer,
const Standard_Real theShapeDeflection)
void StdPrs_WFShape::addEdges (const TopTools_ListOfShape& theEdges,
const Handle (Prs3d_Drawer)& theDrawer,
const Standard_Real theShapeDeflection,
Prs3d_NListOfSequenceOfPnt& thePolylines)
{
ListOfSequenceOfPnt aPointsOfEdges;
TopTools_ListIteratorOfListOfShape anEdgesIter;
for (anEdgesIter.Initialize (theEdges); anEdgesIter.More(); anEdgesIter.Next())
{
@@ -204,7 +244,7 @@ void StdPrs_WFShape::addEdges (const Handle (Prs3d_Presentation)& thePresentatio
{
// Default presentation for edges without triangulation.
BRepAdaptor_Curve aCurve (anEdge);
StdPrs_DeflectionCurve::Add (thePresentation,
StdPrs_DeflectionCurve::Add (Handle(Prs3d_Presentation)(),
aCurve,
theShapeDeflection,
theDrawer,
@@ -214,40 +254,9 @@ void StdPrs_WFShape::addEdges (const Handle (Prs3d_Presentation)& thePresentatio
if (!aPoints->IsEmpty())
{
aPointsOfEdges.Append (aPoints);
thePolylines.Append (aPoints);
}
}
Standard_Integer aNbBounds = aPointsOfEdges.Size();
Standard_Integer aNbVertices = 0;
ListOfSequenceOfPnt::Iterator aPolylineIter;
for (aPolylineIter.Initialize (aPointsOfEdges); aPolylineIter.More(); aPolylineIter.Next())
{
aNbVertices += aPolylineIter.Value()->Length();
}
if (aNbBounds < 1 || aNbVertices < 2)
{
return;
}
// Construct array of primitives.
Handle(Graphic3d_ArrayOfPolylines) aPrimitiveArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
for (aPolylineIter.Initialize (aPointsOfEdges); aPolylineIter.More(); aPolylineIter.Next())
{
const Handle(TColgp_HSequenceOfPnt)& aPoints = aPolylineIter.Value();
aPrimitiveArray->AddBound (aPoints->Length());
for (Standard_Integer anI = 1; anI <= aPoints->Length(); ++anI)
{
aPrimitiveArray->AddVertex (aPoints->Value (anI));
}
}
// Add array of primitives to presentation.
Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
aGroup->SetPrimitivesAspect (theAspect->Aspect());
aGroup->AddPrimitiveArray (aPrimitiveArray);
}
// =========================================================================
@@ -342,11 +351,9 @@ void StdPrs_WFShape::addEdgesOnTriangulation (const Handle(Prs3d_Presentation)&
}
Standard_Integer aNbVertices = aSurfPoints.Length();
Standard_Integer aNbBounds = aNbVertices / 2;
Handle(Graphic3d_ArrayOfSegments) aSurfArray = new Graphic3d_ArrayOfSegments (aNbVertices, aNbBounds);
Handle(Graphic3d_ArrayOfSegments) aSurfArray = new Graphic3d_ArrayOfSegments (aNbVertices);
for (Standard_Integer anI = 1; anI <= aNbVertices; anI += 2)
{
aSurfArray->AddBound (2);
aSurfArray->AddVertex (aSurfPoints.Value (anI));
aSurfArray->AddVertex (aSurfPoints.Value (anI + 1));
}

View File

@@ -19,6 +19,7 @@
#include <Prs3d_Presentation.hxx>
#include <Prs3d_PointAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_NListOfSequenceOfPnt.hxx>
#include <TColgp_SequenceOfPnt.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
@@ -39,16 +40,13 @@ public:
private:
//! Compute edge presentations for a shape.
//! @param thePresentation [in] the presentation.
//! @param theEdges [in] the list of edges.
//! @param theAspect [in] the edge drawing aspect.
//! @param theDrawer [in] the drawer settings.
//! @param theShapeDeflection [in] the deflection for the wireframe shape.
static void addEdges (const Handle (Prs3d_Presentation)& thePresentation,
const TopTools_ListOfShape& theEdges,
const Handle (Prs3d_LineAspect)& theAspect,
const Handle (Prs3d_Drawer)& theDrawer,
const Standard_Real theShapeDeflection);
static void addEdges (const TopTools_ListOfShape& theEdges,
const Handle(Prs3d_Drawer)& theDrawer,
const Standard_Real theShapeDeflection,
Prs3d_NListOfSequenceOfPnt& thePolylines);
//! Compute free and boundary edges on a triangulation of a face.
//! @param thePresentation [in] the presentation.

View File

@@ -177,9 +177,9 @@ std::string ViewerTest_CmdParser::Arg (const std::string& theOptionName, Standar
//===============================================================================================
Graphic3d_Vec3 ViewerTest_CmdParser::ArgVec3f (const std::string& theOptionName, Standard_Integer theArgumentIndex)
{
return Graphic3d_Vec3 (static_cast<Standard_ShortReal> (Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str())),
static_cast<Standard_ShortReal> (Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str())),
static_cast<Standard_ShortReal> (Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str())));
return Graphic3d_Vec3 (static_cast<Standard_ShortReal> (Draw::Atof (Arg (theOptionName, theArgumentIndex ).c_str())),
static_cast<Standard_ShortReal> (Draw::Atof (Arg (theOptionName, theArgumentIndex + 1).c_str())),
static_cast<Standard_ShortReal> (Draw::Atof (Arg (theOptionName, theArgumentIndex + 2).c_str())));
}
//===============================================================================================
@@ -188,9 +188,9 @@ Graphic3d_Vec3 ViewerTest_CmdParser::ArgVec3f (const std::string& theOptionName,
//===============================================================================================
Graphic3d_Vec3d ViewerTest_CmdParser::ArgVec3d (const std::string& theOptionName, Standard_Integer theArgumentIndex)
{
return Graphic3d_Vec3d ( Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()),
Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()),
Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()));
return Graphic3d_Vec3d ( Draw::Atof (Arg (theOptionName, theArgumentIndex ).c_str()),
Draw::Atof (Arg (theOptionName, theArgumentIndex + 1).c_str()),
Draw::Atof (Arg (theOptionName, theArgumentIndex + 2).c_str()));
}
//===============================================================================================
@@ -199,9 +199,9 @@ Graphic3d_Vec3d ViewerTest_CmdParser::ArgVec3d (const std::string& theOptionName
//===============================================================================================
gp_Vec ViewerTest_CmdParser::ArgVec (const std::string& theOptionName, Standard_Integer theArgumentIndex)
{
return gp_Vec ( Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()),
Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()),
Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()));
return gp_Vec ( Draw::Atof (Arg (theOptionName, theArgumentIndex ).c_str()),
Draw::Atof (Arg (theOptionName, theArgumentIndex + 1).c_str()),
Draw::Atof (Arg (theOptionName, theArgumentIndex + 2).c_str()));
}
//===============================================================================================
@@ -210,9 +210,9 @@ gp_Vec ViewerTest_CmdParser::ArgVec (const std::string& theOptionName, Standard_
//===============================================================================================
gp_Pnt ViewerTest_CmdParser::ArgPnt (const std::string& theOptionName, Standard_Integer theArgumentIndex)
{
return gp_Pnt ( Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()),
Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()),
Draw::Atof (Arg (theOptionName, theArgumentIndex).c_str()));
return gp_Pnt ( Draw::Atof (Arg (theOptionName, theArgumentIndex ).c_str()),
Draw::Atof (Arg (theOptionName, theArgumentIndex + 1).c_str()),
Draw::Atof (Arg (theOptionName, theArgumentIndex + 2).c_str()));
}
//===============================================================================================

View File

@@ -18,31 +18,17 @@
#define _gp_TrsfForm_HeaderFile
//! Identifies the type of a geometric transformation.
//! Enumerates all 24 possible variants of generalized
//! Euler angles, defining general 3d rotation by three
//! rotations around main axes of coordinate system,
//! in different possible orders.
//! The name of the enumeration
//! corresponds to order of rotations, prefixed by type
//! of co-ordinate system used:
//! - Intrinsic: rotations are made around axes of rotating
//! co-ordinate system associated with the object
//! - Extrinsic: rotations are made around axes of fixed
//! (reference) co-ordinate system
//! Two specific values provided for most frequently used
//! conventions: proper Euler angles (intrinsic ZXZ) and
//! yaw-pitch-roll (intrinsic ZYX).
enum gp_TrsfForm
{
gp_Identity,
gp_Rotation,
gp_Translation,
gp_PntMirror,
gp_Ax1Mirror,
gp_Ax2Mirror,
gp_Scale,
gp_CompoundTrsf,
gp_Other
gp_Identity, //!< No transformation (matrix is identity)
gp_Rotation, //!< Rotation
gp_Translation, //!< Translation
gp_PntMirror, //!< Central symmetry
gp_Ax1Mirror, //!< Rotational symmetry
gp_Ax2Mirror, //!< Bilateral symmetry
gp_Scale, //!< Scale
gp_CompoundTrsf, //!< Combination of the above transformations
gp_Other //!< Transformation with not-orthogonal matrix
};
#endif // _gp_TrsfForm_HeaderFile

View File

@@ -13,6 +13,6 @@ vdisplay result
vsetdispmode result 1
vfit
checktrinfo result -tri 430 -nod 428
checktrinfo result -tri 453 -nod 447
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -14,6 +14,6 @@ vdisplay result
vsetdispmode result 1
vfit
checktrinfo result -tri 5457 -nod 3967
checktrinfo result -tri 5656 -nod 4088
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -20,7 +20,7 @@ vsetdispmode result 1
vdisplay result
vfit
checktrinfo result -tri 9198 -nod 7543
checktrinfo result -tri 9243 -nod 7586
checkmaxtol result -ref 0.92213088179312575
checknbshapes result -shell 1

View File

@@ -14,7 +14,7 @@ incmesh f 1
trinfo f
checktrinfo f -tri 17 -nod 18 -defl 0.3345840532742983 -tol_abs_defl 1.e-3 -tol_rel_defl 0.01
checktrinfo f -tri 21 -nod 22 -defl 0.3345840532742983 -tol_abs_defl 1.e-3 -tol_rel_defl 0.01
vinit
vdisplay f

View File

@@ -1,5 +1,6 @@
puts "TODO OCC24938 ALL: Error: Number of triangles is equal to 0"
puts "TODO OCC24938 ALL: Error: Number of nodes is equal to 0"
#puts "TODO OCC24938 ALL: Error : area by triangles differs from the actual area by"
puts "=========="
puts "OCC24938"

View File

@@ -15,5 +15,5 @@ fit
isos a 0
triangles a
checktrinfo a -tri 1769 -nod 931 -defl 0.10452721084309395 -tol_rel_defl 0.05 -tol_rel_tri 0.05 -tol_rel_nod 0.05
checktrinfo a -tri 1874 -nod 983 -defl 0.26446929234386068 -tol_rel_defl 0.05 -tol_rel_tri 0.05 -tol_rel_nod 0.05
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

View File

@@ -2,6 +2,9 @@ puts "========================"
puts " OCC397 "
puts "========================"
puts "TODO OCC27226 ALL: Colors are not equal in default"
puts "TODO OCC27226 ALL: Shading is missing in 3D Viewer"
pload QAcommands
restore [locate_data_file OCC397.brep] a

View File

@@ -0,0 +1,10 @@
puts "============"
puts "OCC27391"
puts "============"
puts ""
######################################################
# BRepLib::EnsureNormalConsistency() raises exception in case of asynchronious PolygonOnTriangulation problem
######################################################
restore [locate_data_file bug27391_Ficomirrors_ExportBinMoldflow.brep] a
correctnormals a

View File

@@ -0,0 +1,28 @@
puts "============"
puts "OCC27569"
puts "============"
puts ""
######################################################
# [Regression in 6.9.0] Projecting a curve hangs
######################################################
pload QAcommands
restore [locate_data_file bug27569.brep] aS
explode aS
mkcurve c aS_1
mksurface s aS_2
# Performance check
chrono h reset; chrono h start
OCC24008 c s;
chrono h stop; set q [dchrono h show]
regexp {CPU user time: ([-0-9.+eE]+) seconds} $q full aTime
set MAX_TIME 1.0
if { $aTime > ${MAX_TIME} } {
puts "Elapsed time is more than ${MAX_TIME} seconds - Faulty"
} else {
puts "Elapsed time is less than ${MAX_TIME} seconds - OK"
}

View File

@@ -13,5 +13,5 @@ tclean result
incmesh result .1
triangles result
checktrinfo result -tri 543 -nod 320
checktrinfo result -tri 559 -nod 329
checkview -display result -3d -path ${imagedir}/${test_image}.png

View File

@@ -24,17 +24,17 @@ if { ${Nb} != ${expected_Nb} } {
set tol_abs 1.0e-05
set tol_rel 0.01
set expected_dmax 0.0013771610718045313
set expected_ufmax 0.953125
set expected_dmax 0.00099617706819476581
set expected_ufmax 0.875
checkreal "dmax" ${dmax} ${expected_dmax} ${tol_abs} ${tol_rel}
checkreal "ufmax" ${ufmax} ${expected_ufmax} ${tol_abs} ${tol_rel}
set expected_ulmax 0.96875
set expected_ulmax 0.890625
if { ${ulmax} != ${expected_ulmax} } {
puts "Error : bad value of ulmax=${ulmax}"
}
set expected_i 73
set expected_i 68
if { ${i} != ${expected_i} } {
puts "Error : bad value of i=${i}"
}

View File

@@ -24,7 +24,7 @@ if {$report != ""} {
# Checking triangulation area (triarea command)...
set max_rel_tol_diff 1
set rel_tol 0.4
set rel_tol 0.42
set area_eps 0
smallview

View File

@@ -0,0 +1,27 @@
puts "========"
puts "OCC27108"
puts "========"
puts ""
#################################################################
# GCPnt_TangentialDeflection does not respect linear deflection
#################################################################
set bug27108_requested_deflection 0.03
restore [locate_data_file bug27108_Left.brep] a
explode a e
mkcurve c a_1
set bug_info [crvtpoints result c $bug27108_requested_deflection 20*pi/180]
smallview
donly c result
fit
set bug27108_reached_deflection [lindex $bug_info 6]
if { $bug27108_reached_deflection > $bug27108_requested_deflection} {
puts "ERROR: OCC27108 is reproduced. Requested deflection is less than reached."
}
checkview -screenshot -2d -path ${imagedir}/${test_image}.png

23
tests/bugs/step/bug27329 Normal file
View File

@@ -0,0 +1,23 @@
puts "========"
puts "OCC27329"
puts "========"
puts ""
#########################
# Export to STEP failure
#########################
restore [locate_data_file bug27329_phenix.brep] a
param write.step.nonmanifold 1
param read.step.nonmanifold 1
newmodel
stepwrite 0 a $imagedir/bug27329_temp.stp
stepread $imagedir/bug27329_temp.stp b *
renamevar b_1 result
checknbshapes result -solid 3 -shell 3 -face 42
param write.step.nonmanifold 0
param read.step.nonmanifold 0
newmodel

View File

@@ -13,5 +13,5 @@ isos result 0
triangles result
vfit
checktrinfo result -tri 7980 -nod 8346
checktrinfo result -tri 7984 -nod 8350
checkview -screenshot -3d -path ${imagedir}/${test_image}.png

47
tests/bugs/xde/bug27447 Normal file
View File

@@ -0,0 +1,47 @@
puts "========"
puts "OCC27447"
puts "========"
puts ""
##########################################
# Add support for long IGES entity names
##########################################
pload OCAF
# Part of samples/tcl/xde.tcl
pcylinder pin 1 10
pcylinder nut 2 2
compound nut nut nuts
explode nuts
ttranslate nuts_1 0 0 7
ttranslate nuts_2 0 0 1
compound pin nuts_1 nuts_2 link
NewDocument D XCAF
XAddShape D link
SetName D [XFindShape D pin] "Pin"
SetName D [XFindShape D nut] "Nut"
# Modification of label "Link" to "Very long link name" according to bug's description
SetName D [XFindShape D link] "Very long link name"
SetName D [XFindShape D link]:1 "Pin instance"
SetName D [XFindShape D link]:2 "Nut instance 1"
SetName D [XFindShape D link]:3 "Nut instance 2"
# Write IGES file
catch {exec rm ${imagedir}/bug27447_link.igs}
WriteIges D ${imagedir}/bug27447_link.igs
# Processing of IGES file
set is_bug27447_fixed "FALSE"
set file_27447 [open ${imagedir}/bug27447_link.igs RDONLY]
while {[eof $file_27447] == 0} {
set file_27447_line [string trim [gets $file_27447]]
if {[string first "Very long link name" $file_27447_line] != -1} {
set is_bug27447_fixed "TRUE"
}
}
close $file_27447
# Results validation
if {[string compare $is_bug27447_fixed "FALSE"] == 0} {
puts "ERROR: OCC27447 is reproduced. Long labels in IGES files are not supported."
}

View File

@@ -1,5 +1,5 @@
# !!!! This file is generated automatically, do not edit manually! See end script
puts "TODO CR23096 ALL: NBSHAPES : Faulty"
puts "TODO CR23096 ALL: TPSTAT : Faulty"
set filename ie_soapbox-A.stp
@@ -8,8 +8,8 @@ set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
TPSTAT : Faulties = 0 ( 0 ) Warnings = 28 ( 20 ) Summary = 28 ( 20 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 112 ( 112 ) Summary = 685 ( 687 )
STATSHAPE : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 112 ( 112 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 286 ( 288 )
NBSHAPES : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 112 ( 112 ) Summary = 687 ( 687 )
STATSHAPE : Solid = 2 ( 2 ) Shell = 2 ( 2 ) Face = 112 ( 112 ) FreeWire = 0 ( 0 ) FreeEdge = 0 ( 0 ) SharedEdge = 288 ( 288 )
TOLERANCE : MaxTol = 0.5386330267 ( 1.019942733 ) AvgTol = 0.009444234359 ( 0.01316262156 )
LABELS : N0Labels = 1 ( 1 ) N1Labels = 0 ( 0 ) N2Labels = 0 ( 0 ) TotalLabels = 1 ( 1 ) NameLabels = 1 ( 1 ) ColorLabels = 0 ( 0 ) LayerLabels = 0 ( 0 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )

View File

@@ -3,5 +3,5 @@ set bug_area "OCC22687"
set rel_tol 1.3
if { [string compare $command "shading"] == 0 } {
set bug_withouttri "OCC22687"
set nbwithouttri(ALL) 79
set nbwithouttri(ALL) 74
}

View File

@@ -4,7 +4,7 @@ set max_rel_tol_diff 1
if { [string compare $command "shading"] == 0 } {
set rel_tol 2.06
} else {
set rel_tol 2.15
set rel_tol 2.16
}
set bug_freenodes "OCC22687"

View File

@@ -1,5 +1,6 @@
set TheFileName OCC22302.brep
set bug_freenodes "OCC22687"
set bug_area "OCC22687"
if { [string compare $command "shading"] == 0 } {
set nbfreenodes(ALL) 4
} else {

View File

@@ -1,15 +1,20 @@
set TheFileName shading_025.brep
set bug_freenodes "OCC22687"
if { [string compare $command "shading"] == 0 } {
set nbfreenodes(All) 1
set nbfreenodes(All) 3
} else {
set bug_withouttri "OCC27226"
set bug_freelinks "OCC23105"
### set nbfree(ALL) 4
###set nbfree(ALL) 4
if { [string compare $command "mesh"] == 0 } {
### set nbfree(ALL) 8 ### OCC23106
set nbfree(ALL) 2
set nbwithouttri(All) 1
set nbfreenodes(All) 37
} else {
set nbfree(ALL) 2
set nbwithouttri(All) 1
set nbfreenodes(All) 37
}
set nbfreenodes(All) 4
###set nbfreenodes(All) 37
}

View File

@@ -2,7 +2,7 @@ set TheFileName shading_105.brep
#set bug_area "OCC22687"
set max_rel_tol_diff 1
if { [string compare $command "shading"] == 0 } {
set rel_tol 2.62
set rel_tol 2.64
} else {
set rel_tol 2.55
}

View File

@@ -4,6 +4,7 @@ set bug_withouttri "OCC22687"
set nbwithouttri(ALL) 1
if { [string compare $command "shading"] == 0 } {
set rel_tol 0.13
set nbwithouttri(ALL) 1
} else {
set rel_tol 0.21
}

View File

@@ -3,12 +3,12 @@ set bug_area "OCC22687"
set rel_tol 1.9
set bug_withouttri "OCC22687"
if { [string compare $command "shading"] == 0 } {
puts "TODO OCC23105 ALL: Error: Improvement: The current area difference is"
set nbwithouttri(All) 1
#puts "TODO OCC23105 ALL: Error: Improvement: The current area difference is"
set nbwithouttri(All) 2
set bug_freenodes "OCC22687"
set nbfreenodes(All) 38
} else {
set nbwithouttri(All) 1
set nbwithouttri(All) 2
set bug_freenodes "OCC23105"
set nbfreenodes(ALL) 1
}

View File

@@ -1 +1,3 @@
set TheFileName shading_wrongshape_014.brep
#set bug_withouttri "OCC27226"
#set nbwithouttri(ALL) 1

View File

@@ -8,7 +8,7 @@ set bug_freenodes "OCC22687"
set bug_withouttri "OCC22687"
if { [string compare $command "shading"] == 0 } {
set bug_area "OCC22687"
set rel_tol 1.3
set rel_tol 1.2
set nbwithouttri(ALL) 6
set nbfreenodes(ALL) 1
##set bug_freelinks "OCC22687"

View File

@@ -1,13 +1,14 @@
set TheFileName shading_wrongshape_027.brep
set bug_freenodes "OCC22687"
set nbfreenodes(All) 1
set nbfreenodes(All) 6
set max_rel_tol_diff 1
if { [string compare $command "shading"] != 0 } {
#set bug_area "OCC22687"
set rel_tol 1.2
} else {
set nbfreenodes(All) 2
set rel_tol 0.48
set rel_tol 1.1
set nbfree(All) 2
set bug_freelinks "OCC22687"
}
set nbcross(All) 2
set bug_cross "OCC23184"