MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0029670Community[OCCT] OCCT:DRAWpublic2018-04-03 14:312018-04-03 14:44
Reportereryar 
Assigned Toapn 
PrioritynormalSeverityminor 
StatusnewResolutionopen 
PlatformWindowsOSVC++ 2013OS Version64 bit
Product Version[OCCT] 7.2.0 
Target Version[OCCT] 7.4.0*Fixed in Version 
Summary0029670: vtrihedron xaxis zaxis is wrong
DescriptionWhen I use the command "vtrihedron" to show a frenet frame, it is wrong in the occ7.2.0, but is correct in occ6.9.1.
Steps To Reproduce
#include <TColgp_Array1OfPnt.hxx>

#include <math_BullardGenerator.hxx>

#include <GCPnts_UniformAbscissa.hxx>
#include <GCPnts_UniformDeflection.hxx>
#include <GCPnts_TangentialDeflection.hxx>
#include <GCPnts_QuasiUniformDeflection.hxx>

#include <Geom_BSplineCurve.hxx>

#include <GeomAdaptor_HCurve.hxx>

#include <GeomAPI_PointsToBSpline.hxx>

#include <GeomFill_Fixed.hxx>
#include <GeomFill_Frenet.hxx>
#include <GeomFill_ConstantBiNormal.hxx>
#include <GeomFill_CorrectedFrenet.hxx>
#include <GeomFill_Darboux.hxx>
#include <GeomFill_DiscreteTrihedron.hxx>
#include <GeomFill_GuideTrihedronAC.hxx>
#include <GeomFill_GuideTrihedronPlan.hxx>

#include <BRepBuilderAPI_MakeEdge.hxx>

#include <BRepTools.hxx>


#pragma comment(lib, "TKernel.lib")
#pragma comment(lib, "TKMath.lib")

#pragma comment(lib, "TKG2d.lib")
#pragma comment(lib, "TKG3d.lib")
#pragma comment(lib, "TKGeomBase.lib")
#pragma comment(lib, "TKGeomAlgo.lib")

#pragma comment(lib, "TKBRep.lib")
#pragma comment(lib, "TKTopAlgo.lib")


void test()
{
    TColgp_Array1OfPnt aPoints(1, 6);
    math_BullardGenerator aBullardGenerator;
    for (Standard_Integer i = aPoints.Lower(); i <= aPoints.Upper(); ++i)
    {
        Standard_Real aX = aBullardGenerator.NextReal() * 50.0;
        Standard_Real aY = aBullardGenerator.NextReal() * 50.0;
        Standard_Real aZ = aBullardGenerator.NextReal() * 50.0;

        aPoints.SetValue(i, gp_Pnt(aX, aY, aZ));
    }

    GeomAPI_PointsToBSpline aBSplineFitter(aPoints);
    if (!aBSplineFitter.IsDone())
    {
        return;
    }

    std::ofstream aTclFile("d:/tcl/trihedron.tcl");

    aTclFile << std::fixed;
    aTclFile << "vclear" << std::endl;

    Handle(Geom_BSplineCurve) aBSplineCurve = aBSplineFitter.Curve();
    Handle(GeomAdaptor_HCurve) aCurveAdaptor = new GeomAdaptor_HCurve(aBSplineCurve);

    BRepBuilderAPI_MakeEdge anEdgeMaker(aBSplineCurve);
    BRepTools::Write(anEdgeMaker, "d:/edge.brep");

    aTclFile << "restore " << " d:/edge.brep e" << std::endl;
    aTclFile << "incmesh e " << " 0.01" << std::endl;
    aTclFile << "vdisplay e " << std::endl;

    Handle(GeomFill_Frenet) aFrenet = new GeomFill_Frenet();
    aFrenet->SetCurve(aCurveAdaptor);

    GCPnts_UniformAbscissa aPointSampler(aCurveAdaptor->Curve(), 5.0);
    for (Standard_Integer i = 1; i <= aPointSampler.NbPoints(); ++i)
    {
        Standard_Real aParam = aPointSampler.Parameter(i);
        gp_Pnt aP = aCurveAdaptor->Value(aParam);

        gp_Vec aT;
        gp_Vec aN;
        gp_Vec aB;

        aFrenet->D0(aParam, aT, aN, aB);

        // vtrihedron in opencascade draw 6.9.1
        aTclFile << "vtrihedron vt" << i << " " << aP.X() << " " << aP.Y() << " " << aP.Z() << " "
                 << " " << aB.X() << " " << aB.Y() << " " << aB.Z() << " "
                 << " " << aT.X() << " " << aT.Y() << " " << aT.Z() << std::endl;

        // vtrihedron in opencascade draw 7.1.0 has bug.
        /*aTclFile << "vtrihedron vt" << i << " -origin " << aP.X() << " " << aP.Y() << " " << aP.Z() << " "
            << " -zaxis " << aB.X() << " " << aB.Y() << " " << aB.Z() << " "
            << " -xaxis " << aT.X() << " " << aT.Y() << " " << aT.Z() << std::endl;*/

        // vtrihedron in opencascade draw 7.2.0
        /*aTclFile << "vtrihedron vt" << i << " -origin " << aP.X() << " " << aP.Y() << " " << aP.Z() << " "
            << " -zaxis " << aB.X() << " " << aB.Y() << " " << aB.Z() << " "
            << " -xaxis " << aT.X() << " " << aT.Y() << " " << aT.Z() << std::endl;
        aTclFile << "vtrihedron vt" << i << " -labels xaxis T 1" << std::endl;
        aTclFile << "vtrihedron vt" << i << " -labels yaxis N 1" << std::endl;
        aTclFile << "vtrihedron vt" << i << " -labels zaxis B 1" << std::endl;*/

        aTclFile << "vsize vt" << i << " 2" << std::endl;
    }
}

int main(int argc, char* argv[])
{
    test();

    return 0;
}

TagsNo tags attached.
Test case number
Attached Filespng file icon frenet-occ6.9.1.png (67,661 bytes) 2018-04-03 14:31
png file icon frenet-occ7.2.0.png (63,791 bytes) 2018-04-03 14:32

- Relationships
related to 0029671newabv Remove the direction recomputed mechanism for gp_Ax2 

-  Notes
(0075149)
eryar (developer)
2018-04-03 14:36

The different is the following:
// 6.9.1 ViewerTest_ObjectCommands.cxx
Handle(Geom_Axis2Placement) aPlacement = new Geom_Axis2Placement (anOrigin, aDirZ, aDirX);
  Handle(AIS_Trihedron) aShape = new AIS_Trihedron (aPlacement);

// 7.2.0 ViewerTest_ObjectCommands.cxx
Handle(TColStd_HSequenceOfAsciiString) aValues;
    Handle(Geom_Axis2Placement) aComponent = theTrihedron->Component();
    if (aMapOfArgs.Find ("origin", aValues))
    {
      aComponent->SetLocation (gp_Pnt (aValues->Value (1).RealValue(),
                                       aValues->Value (2).RealValue(),
                                       aValues->Value (3).RealValue()));
    }
    Handle(TColStd_HSequenceOfAsciiString) aXValues, aZValues;
    if (aMapOfArgs.Find ("xaxis", aXValues) && aMapOfArgs.Find ("zaxis", aZValues))
    {
      gp_Dir aXDir (aXValues->Value (1).RealValue(),
                    aXValues->Value (2).RealValue(),
                    aXValues->Value (3).RealValue());

      gp_Dir aZDir (aZValues->Value (1).RealValue(),
                    aZValues->Value (2).RealValue(),
                    aZValues->Value (3).RealValue());

      if (!aZDir.IsNormal (aXDir, M_PI / 180.0))
      {
        std::cout << "Syntax error - parameters 'xaxis' and 'zaxis' are not applied as VectorX is not normal to VectorZ\n";
        return Standard_False;
      }

      aComponent->SetXDirection(aXDir);
      aComponent->SetDirection (aZDir);
    }

- Issue History
Date Modified Username Field Change
2018-04-03 14:31 eryar New Issue
2018-04-03 14:31 eryar Assigned To => apn
2018-04-03 14:31 eryar File Added: frenet-occ6.9.1.png
2018-04-03 14:32 eryar File Added: frenet-occ7.2.0.png
2018-04-03 14:36 eryar Note Added: 0075149
2018-04-03 14:44 eryar Relationship added related to 0029671


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker