fix perpendicular initial position issue and add better tooltips
This commit is contained in:
parent
0099bfd0fd
commit
932c4b5e11
|
@ -632,12 +632,14 @@ template<typename ConstraintVector, typename EquationVector>
|
|||
template< typename T >
|
||||
void Constraint<Sys, Dim>::holder<ConstraintVector, EquationVector>::LGZ::operator()(T& val) const {
|
||||
|
||||
typedef typename Sys::Kernel Kernel;
|
||||
|
||||
if(!val.enabled)
|
||||
return;
|
||||
|
||||
//to treat local gradient zeros we calculate a approximate second derivative of the equations
|
||||
//only do that if neseccary: residual is not zero
|
||||
if(val.m_residual(0) > 1e-7) { //TODO: use exact precission and scale value
|
||||
if(!Kernel::isSame(val.m_residual(0),0, 1e-7)) { //TODO: use exact precission and scale value
|
||||
|
||||
//rotations exist only in cluster
|
||||
if(first->getClusterMode() && !first->isClusterFixed()) {
|
||||
|
@ -645,7 +647,7 @@ void Constraint<Sys, Dim>::holder<ConstraintVector, EquationVector>::LGZ::operat
|
|||
for(int i=0; i<3; i++) {
|
||||
|
||||
//only treat if the gradient realy is zero
|
||||
if(std::abs(val.m_diff_first_rot(i)) < 1e-7) {
|
||||
if(Kernel::isSame(val.m_diff_first_rot(i), 0, 1e-7)) {
|
||||
|
||||
//to get the approximated second derivative we need the slightly moved geometrie
|
||||
const typename Kernel::Vector p_old = first->m_parameter;
|
||||
|
@ -658,7 +660,7 @@ void Constraint<Sys, Dim>::holder<ConstraintVector, EquationVector>::LGZ::operat
|
|||
first->m_parameter = p_old;
|
||||
|
||||
//let's see if the initial LGZ was a real one
|
||||
if(std::abs(res) > 1e-7) {
|
||||
if(!Kernel::isSame(res, 0, 1e-7)) {
|
||||
|
||||
//is a fake zero, let's correct it
|
||||
val.m_diff_first_rot(i) = res;
|
||||
|
@ -672,7 +674,7 @@ void Constraint<Sys, Dim>::holder<ConstraintVector, EquationVector>::LGZ::operat
|
|||
for(int i=0; i<3; i++) {
|
||||
|
||||
//only treat if the gradient realy is zero
|
||||
if(std::abs(val.m_diff_second_rot(i)) < 1e-7) {
|
||||
if(Kernel::isSame(val.m_diff_second_rot(i), 0, 1e-7)) {
|
||||
|
||||
//to get the approximated second derivative we need the slightly moved geometrie
|
||||
const typename Kernel::Vector p_old = second->m_parameter;
|
||||
|
@ -685,7 +687,7 @@ void Constraint<Sys, Dim>::holder<ConstraintVector, EquationVector>::LGZ::operat
|
|||
second->m_parameter = p_old;
|
||||
|
||||
//let's see if the initial LGZ was a real one
|
||||
if(std::abs(res) > 1e-7) {
|
||||
if(!Kernel::isSame(res, 0, 1e-7)) {
|
||||
|
||||
//is a fake zero, let's correct it
|
||||
val.m_diff_second_rot(i) = res;
|
||||
|
|
|
@ -79,7 +79,7 @@ struct Dogleg {
|
|||
number_type tolg, tolx;
|
||||
Kernel* m_kernel;
|
||||
|
||||
Dogleg(Kernel* k) : m_kernel(k), tolg(1e-40), tolx(1e-20) {
|
||||
Dogleg(Kernel* k) : m_kernel(k), tolg(1e-40), tolx(1e-20){
|
||||
|
||||
#ifdef USE_LOGGING
|
||||
log.add_attribute("Tag", attrs::constant< std::string >("Dogleg"));
|
||||
|
@ -538,7 +538,7 @@ struct Kernel : public PropertyOwner< mpl::vector<precision> > {
|
|||
bool isOpposite(const E::MatrixBase<DerivedA>& p1,const E::MatrixBase<DerivedB>& p2) {
|
||||
return ((p1+p2).squaredNorm() < getProperty<precision>());
|
||||
}
|
||||
|
||||
|
||||
int solve(MappedEquationSystem& mes) {
|
||||
nothing n;
|
||||
return NonlinearSolver(this).solve(mes, n);
|
||||
|
@ -548,7 +548,7 @@ struct Kernel : public PropertyOwner< mpl::vector<precision> > {
|
|||
int solve(MappedEquationSystem& mes, Functor& f) {
|
||||
return NonlinearSolver(this).solve(mes, f);
|
||||
};
|
||||
|
||||
|
||||
typedef mpl::vector1<precision> properties;
|
||||
};
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="first_geom">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The first geometry to which the constraint relates. Note that first and second geometry can be swapt. If you want to clear it, use the button to the right. If it is empty, just select any geometry in the 3D view and it will be added here.</p></body></html></string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
@ -31,6 +34,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="clear_first">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Clear the first geometry</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
|
@ -49,6 +55,9 @@
|
|||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="second_geom">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The second geometry to which the constraint relates. Note that first and second geometry can be swapt. If you want to clear it, use the button to the right. If it is empty, just select any geometry in the 3D view and it will be added here.</p></body></html></string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
@ -62,6 +71,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="clear_second">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Clear the second geometry</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
|
@ -105,6 +117,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Setthe distance between first and second geometrie. Note that in many cases the shortes distance is used (e.g. line - line)</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Distance</string>
|
||||
</property>
|
||||
|
@ -143,6 +158,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Special constraint which is in general used to let the geometries be on each other. Therefore it's often the same as align, with the difference that it is also defined for points, as a point can lie on a plane. Note that this constraint has a special behaviour for cylinders. For example, a cylindrical surface can't be on a plane, only touch it. Therefore this is not valid. Furthermore point and line coincident with cylinders don't work on the cylinder surface, but on its center line. The reason for that it is, that this centerline would not be accessible with other constraints, but the surface coincident can be also achieved with the align constraint and value 0. At last specialty the cylinder cylinder constraint shall be mentioned: It works also on the cylinder centerlines and therefore makes them concentric. </p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Coincident</string>
|
||||
</property>
|
||||
|
@ -181,6 +199,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Fixes the first geometry in its rotation and translation. Note that fix only works its the direct parrent assembly. If you stack assemblys, the parent assembly will not be fixed inside the other ones.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fix</string>
|
||||
</property>
|
||||
|
@ -219,6 +240,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Allows to set the orientation of the geometries normals in relation to each other. Possible values are parallel (means equal or opposite normals), equal normals, opposite normals or perpendicular ones. Note that for cylinders the base circles normal is used.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Orientation</string>
|
||||
</property>
|
||||
|
@ -257,6 +281,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Adds a orientation and a distance constraint. Therefore this constraint is only valid where both of the individual constraints are, e.g. you can't align a point and a plane as point-plane orientation is invalid. Furthermore it can happen that this constraint is only valid for a certain orientation, e.g. plane - line has only a defined distance, when the orientation is perpendicular. The reason behind this is, that a non-perpendicular line would always cut the plane and therefore the shortest distance would always be 0. </p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Align</string>
|
||||
</property>
|
||||
|
@ -295,6 +322,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Set the angle between the geometries normals</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Angle</string>
|
||||
</property>
|
||||
|
@ -399,12 +429,15 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="bidirectional">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
<string><html><head/><body><p>Use the full solution space. The nearest solution will be found.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
|
@ -441,6 +474,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Positive solution space. Reduces the valid solutions to the positive domain, e.g. point over the plane at specified distance, not under. Or point outside a cylinder at specified distance, not inside.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
|
@ -473,6 +509,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Negative solution space. Reduces the valid solutions to the negative domain, e.g. point under the plane at specified distance, not over. Or point inside a cylinder at specified distance, not outside.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
|
@ -527,6 +566,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Makes the geometries normals parallel, that means they can point in the same or opposite direction. Note that for cylinders the base circles normal is used.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Parallel</string>
|
||||
</property>
|
||||
|
@ -562,6 +604,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Makes the geometries normals point in the same direction. Note that for cylinders the base circles normal is used.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Equal</string>
|
||||
</property>
|
||||
|
@ -600,6 +645,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Makes the geometries normals point in the opposite direction. Note that for cylinders the base cirles normal is used.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Opposite</string>
|
||||
</property>
|
||||
|
@ -635,6 +683,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Makes the geometries normals perpendicular. Note that for cylinders the base cirles normal is used.</p></body></html></string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
|
Loading…
Reference in New Issue
Block a user