RhinoCommon: Sorting of curves in HiddenLineDrawing

Hello @GregArden

I am experimenting further with HiddenLineDrawing Class.
Please see file enclosed.


Make2D_CurveSorting.3dm (114.0 KB)

Blue curve belongs to the surface. HiddenLineDrawing sometimes computes this curve as Hidden and sometimes - not.
Is it possible to set that such curves need to be always considered as Hidden?

Thanks a lot in advance,
Dmitriy

And even more complicated question: how to differentiate between red and blue curve in case if both are computed as Hidden?


Make2D_CurveSorting_2.3dm (118.2 KB)

Thanks,
Dmitriy

Hello @GregArden,

One more issue related to this:
Sidefill value given below has only 3 values:

  • SideUnset or 0
  • SideSurface or 1
  • SideVoid or 2

image

However some segments are also giving results with index 3. What Index 3 stays for?

Thanks,
Dmitriy

Hello again @GregArden maybe this time aslo @dale

I am trying to get a SourceObject.Geometry for Parent Curve from Segment after computing HLD.
I also checked: Segment.ParentCurve.SourceObject.Geometry.IsValid
However at some point Rhino just crashes.
If I use SourceObjectComponentIndex.ComponentIndexType - everything works fine. Very strange…

Any hint what is going wrong?

Thanks,
Dmitriy

Hi @Dmitriy
Sorry it took a while to get back to you. You have few questions here. Let me see if I can address some of them.
It seems to me that in both examples, curves from the inner surfaces are expected to produce visible lines (since they intersect with the walls). I’d like to test the case when they are marked as hidden instead of visible. Do you have an example, or does that happen randomly?
It is curious that you see a SideFill value=3. Can you share an example that I can debug at my end with such value? Same with the “Segment.ParentCurve.SourceObject.Geometry.IsValid”, it would help great deal to debug an example.

Hello @rajaa

Thanks for taking this further.

Well, I am experimenting with rather simple examples - so please find file enclosed.
Make2D_CurveSorting_ToMcNeel.3dm (198.8 KB)

Layers are arranged to accommodate each type of the Segment.SegmentVisibility.
If segment is Visible - then sub-layers are arranged to receive different combinations of FillSide(0) and FillSide(1).

From there you can easily trace what combination of FillSide is produced.
Geometry to include into HLD is given in layer Geo.
Curves are produced in top view and translated with -50 units in y direction.

Current HLD is computed with tolerance 0.001. However, when decreasing tolerances - output is different.

Now to the SourceObject -> when I try to receive any info about SourceObject (one of the Breps located on Layer “Geo”) - my Rhino is hard-crashed, see below:

image

All computing I am doing in custom GH component - therefore I cannot post complete code here.

P.S. Is @GregArden is still a main developer behind HLD or you took it over?

Thanks a lot in advance,

Dmitriy

@Dmitriy can you share the code you have written to extract vector drawing? You may email directly to me if you’d rather keep it confidential.

Greg is the developer that writes the HLD SDK and the core calculation code. I wrote the Make2D command that uses the SDK classes and output result. Some reported bugs are command level (I’m the one that fixes those), but others have to do with how curves are calculated, and what properties they have, and Greg takes care of those. I hope this helps.

Dmitry,
Regarding your file [Make2D_CurveSorting.3dm ] where an edge of one surface is lying on the interior of another visible surface. It looks to my like a curve that lies on a visible portion of a surface is visible, even if the surface that is boarders is occluded. Do you think this is wrong? What kind of realistic model do you have that is presenting a problem? I don’t have a way of identifying this case in the HLD output currently.

Value 3 for SideFill is OtherSurface.
This indicates that the region to this side of the curve is filled by another surface that is not connected in the 3d model to this edge. For example in the model and hiddenline drawing shown Object_Silhouette.3dm (332.6 KB) the pink lines have SideFill of { SideSurface, OtherSurface} indicating they are kind of an object silhouette, ( actually a discontinuity of the camera ray intersection , as you move across this line the camera ray is intersecting a different object or the same object but at a different depth).

Please let me know if this is useful or if you find bugs.

This feature of HiddenLineDrawing may have bugs because it is not used in the Make2d command.

The first bug is the documentation of the class ON_SIL_EVENT::SIDE_FILL in the C++ SDK and HiddenLineDrawingSegnment in RhinoCommon.

If you can post a model and a GH component that demonstrates the crash that would be very helpful.

Also in your model you have surfaces that intersect where the intersection is not part of the model. This will now work well in Make2d/HiddenLineDrawing. Still it shouldn’t crash.

Hello @GregArden

Thanks.
While I am checking SideFill condition, I have sent you a message.

Dmitriy

Hello @GregArden

I don’t think it is wrong neither right. This depends on the application purpose. It just would be nice to identify those curves as separate type.
At the moment I have found out those curves can be computed as Hidden and Visible. When visible - they are of SideFill type SideSurface(1)+OtherSurface(3) or OtherSurface(3)+SideSurface(1). That is already good as it narrows down any additional check that would be required.

I have an idea how to do this, but to check it - I need to be able to access SourceObject at first and this is a point where I experience crash.

Considering what you wrote in the previous post - I have analysed curves produced with HLD in my file (enclosed here earlier Make2D_CurveSorting_ToMcNeel.3dm). All the curves computed as visible are having SideFill 3(OtherSurf)-1(SideSurf) which is correct. But at the same time such curves sometimes are computed as Hidden.

RH-45865 is fixed in the latest Service Release Candidate

Hello @GregArden and @rajaa
I have checked property ParentCurve.Segments under HLD segments and it still gives an empty list.
Was it registered in YouTrack?

I have following 2 questions:

  • is it any other way to get geometry of the parent curve other than ParentCurve.Segments?
  • is parametrisation (changing of parameter along the curve) of the ParentCurve is the same as original BrepEdge curve of SourceObject? (in case if SourceObject is Brep).

Thanks,
Dmitriy

What service release of Rhino 6 are you using?

Using SR5.

Hello @GregArden and @rajaa

Enclosed is the test example where Make2D gives quite some double edges.
Can you please look at this?

ToMcNeel_Segments.3dm (122.8 KB)

Thanks,
Dmitriy

Dmitry the You Track item for the empty array in ParentCurve was RH-45911.

Here are some comments regarding ToMcNeel_Segments.3dm see ToMcNeel_Segments(Annotated).3dm (146.0 KB):

  1. Intersecting Geometry The vertical surface intersects both the horizontal surface and the tapered, extruded rectangle in their interiors. Therefore to get reliable results you should run intersect on these two surface and include these curve in the Make2d.
    This is generally necessary because Make2d doesn’t find these curves and they are needed for correct results to be computed. In this case it doesn’t seem to matter.
  2. Tolerance. The main issue here is the absolute model tolerance is set to .0005. This is the tolerance used to decide if two curves are distinct or duplicate. In this case the “vertical” surface is not perfectly vertical so it projects to a very thin quadrilateral not a line. That is the source of your “duplicate” curves.