DiscussionsIssue archiveOCCT:Visualization

Archived issue #0026840

OCCT Visulazation doesn't support un-scalable solid arrow.

CommunityOCCT:Visualizationclosed9 public notes

Search issues

Description

In most cases, the user expected arrow is drawn as solid and also the size should not scale by camera zooming. The two images attached will show the differences.

Public activity

9 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Dear Vico,

the bug description is too imprecise - "OCCT Visualization" provides all capabilities needed to draw 2D arrows with zoom-persistent tips, and many applications already do that.

If you are missing some options for specific presentation class (e.g. within predefined list of interactive objects in package AIS) - please at least name it.

02Author
Dear kgv,

What i need is arrows in 3d space not just in 2d. I have tried with zoom-persistent in 3d space but the result is incorrect.

Let me describe my requirements more clearly.
I want to draw an arrow start from gp_Pnt(0,0,0) to gp_Pnt(10, 10, 10). And then i create the arrow with options Prs3d_ArrowAspect to specify the arrow size. Plese see the code of below:
void MyRendering_Direction::Compute(const Handle(PrsMgr_PresentationManager3d)& thePrsMgr, const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode)
{
    // Set style for arrow
    Handle(Prs3d_ArrowAspect) anArrowAspect = myDrawer->ArrowAspect();

    // Draw Line
    Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments(2);
    aPrims->AddVertex(myStartPnt);
    aPrims->AddVertex(myEndPnt);
    Prs3d_Root::CurrentGroup(thePresentation)->SetPrimitivesAspect(myDrawer->LineAspect()->Aspect());
    Prs3d_Root::CurrentGroup(thePresentation)->AddPrimitiveArray(aPrims);

    // Draw arrow
    Prs3d_Arrow::Draw(thePresentation, myEndPnt, gp_Dir(gp_Vec(myStartPnt, myEndPnt)), anArrowAspect->Angle(), anArrowAspect->Length());
}

Usage as below:
    Handle(MyRendering_Direction) aDirection = new MyRendering_Direction(aP1, aP2);
    Handle(Prs3d_LineAspect) aLineAttrib = new Prs3d_LineAspect(Quantity_NOC_RED, Aspect_TOL_SOLID, 6.0);
    aDirection->SetTransformPersistence(Graphic3d_TMF_ZoomPers);
    aDirection->Attributes()->SetLineAspect(aLineAttrib);

The generated arrow's two ends will even not changes during zooming. This is not my expected. I hope that the arrow's two ends still keep touch the same 3d points aP1 and aP2.
03Author
The "Solid" arrow might be composed of a solid cylinder and a solid cone.
04Author
The pixel radius of the cylinder and cone size should not be changed during zooming.
05Author
I don't think "OCCT Visualization" have such capability to do that.
06Commenter 2
    aDirection->SetTransformPersistence(Graphic3d_TMF_ZoomPers);

your code does not define anchor point for transformation persistence:
  //! Sets up Transform Persistence Mode for this object.
  //! This function used to lock in object position, rotation and /
  //! or zooming relative to camera position.
  //! Object will be drawn in the origin setted by APoint parameter
  ...
  void SetTransformPersistence (const Graphic3d_TransModeFlags& aFlag,
                                const gp_Pnt& APoint);

The presentation itself should be defined in local reference system related to anchor point.

    Handle(MyRendering_Direction) aDirection = new MyRendering_Direction(aP1, aP2);

if I'm not wrong, you are trying to create a single presentation object which you are expecting should combine zoom-persistent (arrow tip) and normal (line segment) parts.
This can be done by connecting interactive objects or graphic3d structures.

07Author
Dear kgv,

Your understanding is exact. Would you please describe how to do that by connecting interactive objects or graphic3d structures? I can't find any hint in the entire OCCT source codes.
08Commenter 2
The following Draw Harness script shows the idea how such presentations can be defined:
pload MODELING VISUALIZATION
vclear
vinit View1
box b1 -1 0 0 1 2 3
box b2  1 0 0 1 2 3
vdisplay -dispMode 1 b1 b2
vfit
vdrawparray l segments v 0 0 0 v 1 0 0
vdrawparray a triangles v -30 -10 0 v -30 10 0 v 0 0 0
vdisplay a -trsfPers zoom -trsfPersPos 1 0 0
vconnect aa 0 0 0 a l
verase a l
09Author
Dear kgv, It's cool. I understand it now. I appriciate your kindly help. Please close this issue.

Related records