MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0031605Community[OCCT] OCCT:Foundation Classespublic2020-06-10 11:422020-06-10 11:42
Reporteraothms 
Assigned Toabv 
PrioritynormalSeverityminor 
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0031605: gp_GTrsf::SetVectorialPart sets scale to 0.0 causing non-invertable matrix
DescriptionI sometimes get a 4x4 matrix from external sources that I want to convert to a shape location. So I use gp_GTrsf, check form, convert to gp_Trsf and TopLoc_Location.

The most straightforward way to do this is to use gp_GTrsf::SetVectorialPart(), but that sets the internal scale value to 0.0. I don't think this is necessary: there is code in OCCT to calculate scale from the gp_Mat I think and I also don't know why gp_GTrsf carries a single scale value as it allows non-uniform scale.

I'd happily provide a fix if I get some guidance on the most desirable way to address this.
Steps To ReproduceExecute the code below and witness an exception in gp_Trsf::Invert()

---------------
#include <gp_Mat.hxx>
#include <gp_GTrsf.hxx>
#include <TopLoc_Location.hxx>
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <gp_Pln.hxx>
#include <TopoDS_Face.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>

int main(int, char**) {
    gp_Mat mat(gp::DX().XYZ(), gp::DY().XYZ(), gp::DZ().XYZ());
    gp_GTrsf trsf;
    trsf.SetVectorialPart(mat);
    trsf.SetForm();
    TopLoc_Location loc(trsf.Trsf());

    TopoDS_Face f = BRepBuilderAPI_MakeFace(gp_Pln(), 0.1, 0.1, 0.2, 0.2).Face();
    f.Move(loc);
    TopExp_Explorer exp(f, TopAbs_EDGE);
    TopoDS_Edge e = TopoDS::Edge(exp.Current());

    double u0, u1;
    BRep_Tool::CurveOnSurface(e, f, u0, u1);
}
--------------
TagsNo tags attached.
Test case number
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2020-06-10 11:42 aothms New Issue
2020-06-10 11:42 aothms Assigned To => abv


Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker