MantisBT - Community
View Issue Details
0026840Community[OCCT] OCCT:Visualizationpublic2015-11-05 05:192016-11-19 08:44
Vico Liang 
bugmaster 
lowfeature 
closedno change required 
 
 
0026840: OCCT Visulazation doesn't support un-scalable solid arrow.
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.
No tags attached.
related to 0027919verified bugmaster Open CASCADE Visualization - support multiple transformation persistence groups within single presentation 
png OCCTArrow.png (15,061) 2015-11-05 05:19
https://tracker.dev.opencascade.org/
png ExpectedArrow.png (2,729) 2015-11-05 05:19
https://tracker.dev.opencascade.org/
png arrow_1.png (19,092) 2016-05-23 16:06
https://tracker.dev.opencascade.org/
png arrow_2.png (20,735) 2016-05-23 16:06
https://tracker.dev.opencascade.org/
Issue History
2015-11-05 05:19Vico LiangNew Issue
2015-11-05 05:19Vico LiangAssigned To => kgv
2015-11-05 05:19Vico LiangFile Added: OCCTArrow.png
2015-11-05 05:19Vico LiangFile Added: ExpectedArrow.png
2015-11-05 10:09kgvNote Added: 0047782
2015-11-05 10:09kgvAssigned Tokgv => Vico Liang
2015-11-05 10:09kgvStatusnew => feedback
2015-11-05 10:09kgvNote Edited: 0047782bug_revision_view_page.php?bugnote_id=47782#r12103
2015-11-05 10:10kgvPrioritynormal => low
2015-11-05 10:10kgvSeverityminor => feature
2015-11-05 10:10kgvTarget Version7.0.0 => 7.1.0
2015-11-05 10:33Vico LiangNote Added: 0047783
2015-11-05 10:35Vico LiangAssigned ToVico Liang => kgv
2015-11-05 10:38Vico LiangNote Added: 0047784
2015-11-05 10:42Vico LiangNote Added: 0047785
2015-11-05 10:44Vico LiangNote Added: 0047786
2015-11-05 11:17kgvNote Added: 0047795
2015-11-05 11:17kgvNote Edited: 0047795bug_revision_view_page.php?bugnote_id=47795#r12112
2015-11-05 11:18kgvNote Edited: 0047795bug_revision_view_page.php?bugnote_id=47795#r12113
2015-11-05 16:29Vico LiangNote Added: 0047841
2015-11-06 10:12Vico LiangStatusfeedback => assigned
2016-05-23 16:05kgvNote Added: 0054298
2016-05-23 16:05kgvAssigned Tokgv => Vico Liang
2016-05-23 16:05kgvStatusassigned => feedback
2016-05-23 16:05kgvResolutionopen => no change required
2016-05-23 16:06kgvFile Added: arrow_1.png
2016-05-23 16:06kgvFile Added: arrow_2.png
2016-05-24 05:09Vico LiangNote Added: 0054319
2016-05-24 05:09Vico LiangAssigned ToVico Liang => kgv
2016-05-24 08:29kgvAssigned Tokgv => bugmaster
2016-05-24 08:29kgvTarget Version7.1.0 =>
2016-05-24 11:16bugmasterStatusfeedback => closed
2016-11-19 08:44kgvRelationship addedrelated to 0027919

Notes
(0047782)
kgv   
2015-11-05 10:09   
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.

(0047783)
Vico Liang   
2015-11-05 10:33   
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.
(0047784)
Vico Liang   
2015-11-05 10:38   
The "Solid" arrow might be composed of a solid cylinder and a solid cone.
(0047785)
Vico Liang   
2015-11-05 10:42   
The pixel radius of the cylinder and cone size should not be changed during zooming.
(0047786)
Vico Liang   
2015-11-05 10:44   
I don't think "OCCT Visualization" have such capability to do that.
(0047795)
kgv   
2015-11-05 11:17   
(edited on: 2015-11-05 11:18)
    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.

(0047841)
Vico Liang   
2015-11-05 16:29   
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.
(0054298)
kgv   
2016-05-23 16:05   
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
(0054319)
Vico Liang   
2016-05-24 05:09   
Dear kgv, It's cool. I understand it now. I appriciate your kindly help. Please close this issue.