Create a custom marker

Hey,

I am looking to make a custom marker of multiple >, that could be >> or >>>. I wrote the following code, and it seems to work, but the markers come out as circles. What am I doing wrong?

HPS::GlyphPoint ConvertToGlyphPt( std::vector<double> const& point )
{
  HPS::GlyphPoint glyphPoint;
  auto normalizedPt = NormalizePoint( point );
  glyphPoint.x = normalizedPt.x;
  glyphPoint.y = normalizedPt.y;
  return glyphPoint;
}

void InsertArrows( COLORREF                      color,
                   int                           lineStyle,
                   std::vector<Arrowhead> const& arrowheads )
{
  if( arrowheads.empty() )
  {
    return;
  }

  HPS::SegmentKey childSegmentKey = plot.Subsegment( "Arrowheads" ).Subsegment();

  CStringA glyphName {};
  glyphName.Format( "arrowhead_%zu", arrowheads.size() );  
  if( !m_portfolio.ShowGlyphDefinition( glyphName.GetString() ) )
  {
    HPS::GlyphKit glyphBuilder   {};
    glyphBuilder.SetRadius( 0 );
    glyphBuilder.SetOffset( { 0, 0 } );
    HPS::LineGlyphElement arrows {};
    HPS::PointArray pointArray;

    HPS::GlyphPointArray points {};
    for( auto i { 0 }; i < arrowheads.size(); ++i )
    {
      points.push_back( ConvertToGlyphPt( arrowheads[i].center ) );
      points.push_back( ConvertToGlyphPt( arrowheads[i].legOne ) );
      points.push_back( ConvertToGlyphPt( arrowheads[i].center ) );
      points.push_back( ConvertToGlyphPt( arrowheads[i].legTwo ) );
      points.push_back( ConvertToGlyphPt( arrowheads[i].center ) );
      if( i != arrowheads.size() - 1 )
      {
        points.push_back( ConvertToGlyphPt( arrowheads[i + 1].center ) );
      }
    }
    arrows.SetPoints( points );
    glyphBuilder.SetElement( arrows );
    m_portfolio.DefineGlyph( glyphName.GetString(), glyphBuilder );
  }

  childSegmentKey.GetMarkerAttributeControl().SetSymbol( glyphName.GetString() );
  childSegmentKey.GetMaterialMappingControl().SetMarkerColor( COLORREF2RGB( color ) );
  childSegmentKey.GetMarkerAttributeControl().SetSize( 20, HPS::Marker::SizeUnits::Pixels );

  HPS::Vector           translationVector {};
  msl::XYZPoint<double> normalizedCenter  {};
  NormalizeToCurrentWindow( arrowheads[0].center, normalizedCenter, translationVector );

  HPS::MatrixKit childSegmentMatrix;
  childSegmentMatrix.Translate(       translationVector  );
  childSegmentKey.SetModellingMatrix( childSegmentMatrix );

  childSegmentKey.InsertMarker( HPS::Point( normalizedCenter.x,
                                            normalizedCenter.y,
                                            normalizedCenter.z ) );
}

After a quick review of your code, you should set the radius > 0. The value doesn’t refer exclusively to a circle but specifies the drawing canvas size for the glyph (cf. Glyphs — HOOPS Visualize Desktop Documentation). You might check your implementation against the other steps under Custom Glyphs in the linked documentation.

Hope this helps.

Mike