OpticConstraints: Adding Snell's law
Fix AngleViaPoint to support new derivative calculation technique. OpticConstraints: Adding Snell's law. Fix AngleViaPoint to support new derivative calculation technique. Snell's law constraint added to GCS, but not yet exposed and cannot be tested. Since the way CalculateNormal() returns derivatives had changed, AngleViaPoint constraint needed modifications. Nothing serious. OpticConstraints: SnellsLaw progress Addable through python. Fix math. Some quick-and-dirty visual stuff to get rid of hangs and to see the constraint in action. OpticConstraints: SnellsLaw: flipping logic fix OpticConstraints: SnellsLaw progress Added toolbar button. Allowed editing a datum by doubleclick. New error message approach during constraint creation. OpticConstraints: SnellsLaw OpticConstraints: SnellsLaw: list label improvement OpticConstraints: SnellsLaw: fix after rebase OpticConstraints: SnellsLaw: expose helper constraints Snell's law internally is made of three constraints: point-on-object, coincident and the Snell's sin/sin. They were all buried under one UI constraint. Exposing them allows to construct reflection and birefringence on the point (attempting to do so used to result in redundant constraints and was often not functional at all). This commit breaks compatibility with older files. OpticConstraints: SnellsLaw: small refactor of math Placing the duplicated code of error and gradient calculation into a private method. OpticConstraints: SnellsLaw: fix datum edit unit OpticConstraints: SnellsLaw: fix datum edit bug After previous fix, the dimensionless value was not accepted (the constraint's value did not change, the changes were ignored).
This commit is contained in:
@@ -920,7 +920,8 @@ void ViewProviderSketch::editDoubleClicked(void)
|
||||
Constr->Type == Sketcher::DistanceX ||
|
||||
Constr->Type == Sketcher::DistanceY ||
|
||||
Constr->Type == Sketcher::Radius ||
|
||||
Constr->Type == Sketcher::Angle) {
|
||||
Constr->Type == Sketcher::Angle ||
|
||||
Constr->Type == Sketcher::SnellsLaw ) {
|
||||
|
||||
// Coin's SoIdleSensor causes problems on some platform while Qt seems to work properly (#0001517)
|
||||
EditDatumDialog *editDatumDialog = new EditDatumDialog(this, *it);
|
||||
@@ -2323,7 +2324,9 @@ QString ViewProviderSketch::iconTypeFromConstraint(Constraint *constraint)
|
||||
case Equal:
|
||||
return QString::fromAscii("small/Constraint_EqualLength_sm");
|
||||
case Symmetric:
|
||||
return QString::fromAscii("small/Constraint_Symmetric_sm");
|
||||
return QString::fromAscii("small/Constraint_Symmetric_sm");
|
||||
case SnellsLaw:
|
||||
return QString::fromAscii("small/Constraint_SnellsLaw_sm");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
@@ -3448,12 +3451,14 @@ Restart:
|
||||
break;
|
||||
case PointOnObject:
|
||||
case Tangent:
|
||||
case SnellsLaw:
|
||||
{
|
||||
assert(Constr->First >= -extGeoCount && Constr->First < intGeoCount);
|
||||
assert(Constr->Second >= -extGeoCount && Constr->Second < intGeoCount);
|
||||
|
||||
Base::Vector3d pos, relPos;
|
||||
if ( Constr->Type == PointOnObject ||
|
||||
Constr->Type == SnellsLaw ||
|
||||
(Constr->Type == Tangent && Constr->Third != Constraint::GeoUndef) || //Tangency via point
|
||||
(Constr->Type == Tangent && Constr->FirstPos != Sketcher::none) //endpoint-to-curve or endpoint-to-endpoint tangency
|
||||
) {
|
||||
@@ -3897,6 +3902,7 @@ void ViewProviderSketch::rebuildConstraintsVisual(void)
|
||||
break;
|
||||
case PointOnObject:
|
||||
case Tangent:
|
||||
case SnellsLaw:
|
||||
{
|
||||
// #define CONSTRAINT_SEPARATOR_INDEX_MATERIAL_OR_DATUMLABEL 0
|
||||
sep->addChild(mat);
|
||||
@@ -3950,7 +3956,7 @@ void ViewProviderSketch::rebuildConstraintsVisual(void)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
edit->vConstrType.push_back(None);
|
||||
edit->vConstrType.push_back((*it)->Type);
|
||||
}
|
||||
|
||||
edit->constrGroup->addChild(sep);
|
||||
|
||||
Reference in New Issue
Block a user