-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ISE: Internal failure, constraint not added #15
Comments
ISE confirmed - no VertexMergerGroup found for near vertices. I have temporary workaround. I set merge group ID to vertex when adding to group. Before calling processConstraint I replace all vertices in constraint with VertexMergerGroup if applicable. And then I remove all subsequent duplicates. I still have to make minimal test. |
Thanks. I'm rather busy the next week, but will try to look at it soon. A
minimal test would certainly help
…On Jun 26, 2017 10:57 AM, "Martin JANDA" ***@***.***> wrote:
ISE confirmed - no VertexMergerGroup found for near vertices.
I have temporary workaround. I set merge group ID to vertex when adding to
group. Before calling processConstraint I replace all vertices in
constraint with VertexMergerGroup if applicable. And then I remove all
subsequent duplicates.
I still have to make minimal test.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ASyR4eqaOduzxCRO4uJAudxftpLAwoiBks5sH8bMgaJpZM4OFZJX>
.
|
`
` |
Rows with ID 24, 25 are similar. These should fall into same vertex group. When you comment ID 26. You get NPE from another part of code. |
NPE is tracked as #17 NPE: processing polygon constraint |
Here data are valid. No segment intersections, ... |
Thanks for the updates. Am reviewing the issues and will inform you when I
have fixes.
…On Sun, Sep 24, 2017 at 10:09 AM, Martin JANDA ***@***.***> wrote:
Here data are valid. No segment intersections, ...
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ASyR4UpMsc2RDqI9kmhgOhwJYa8USfuiks5slmKxgaJpZM4OFZJX>
.
|
Made some progress on issue #15 today. I will do some more testing and
then post code.
The new code will change the way constraints are processed. As you know,
when a closed polygon constraint is added, its first and last vertices will
have the same coordinates. The PolygonConstraint class' method called
complete() ensures that this requirement is met. If the input geometry
does not include a "closure vertex" (my terminology for the case where the
first vertex has the same coordinates as the last vertex), it simply copies
the first vertex in the constraint onto its end. In your case, you'd
already supplied a closure vertex, so the complete() method did nothing.
The Tinfour code got confused, however, because your closure vertex was a
different object than your first vertex. In all my testing, I always used
the same object. You did something a little different than I did (a little
different... but correct nevertheless... the code should have handled it).
I hope to have the updates posted tonight (my time). If testing takes a
little longer, I'll let you know.
I still haven't looked at your other test data yet.
Gary
On Sun, Sep 24, 2017 at 12:46 PM, Gary Lucas <contact.tinfour@gmail.com>
wrote:
… Thanks for the updates. Am reviewing the issues and will inform you when
I have fixes.
On Sun, Sep 24, 2017 at 10:09 AM, Martin JANDA ***@***.***>
wrote:
> Here data are valid. No segment intersections, ...
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#15 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ASyR4UpMsc2RDqI9kmhgOhwJYa8USfuiks5slmKxgaJpZM4OFZJX>
> .
>
|
It's strange because I think that non identical first and last vertex will be merged. There is question whether virtual merged vertex fully supports constraints.
Thank you very much for your time.
Martin
24. 9. 2017 v 23:20, gwlucastrig <notifications@github.com>:
… Made some progress on issue #15 today. I will do some more testing and
then post code.
The new code will change the way constraints are processed. As you know,
when a closed polygon constraint is added, its first and last vertices will
have the same coordinates. The PolygonConstraint class' method called
complete() ensures that this requirement is met. If the input geometry
does not include a "closure vertex" (my terminology for the case where the
first vertex has the same coordinates as the last vertex), it simply copies
the first vertex in the constraint onto its end. In your case, you'd
already supplied a closure vertex, so the complete() method did nothing.
The Tinfour code got confused, however, because your closure vertex was a
different object than your first vertex. In all my testing, I always used
the same object. You did something a little different than I did (a little
different... but correct nevertheless... the code should have handled it).
I hope to have the updates posted tonight (my time). If testing takes a
little longer, I'll let you know.
I still haven't looked at your other test data yet.
Gary
On Sun, Sep 24, 2017 at 12:46 PM, Gary Lucas ***@***.***>
wrote:
> Thanks for the updates. Am reviewing the issues and will inform you when
> I have fixes.
>
> On Sun, Sep 24, 2017 at 10:09 AM, Martin JANDA ***@***.***>
> wrote:
>
>> Here data are valid. No segment intersections, ...
>>
>> —
>> You are receiving this because you commented.
>> Reply to this email directly, view it on GitHub
>> <#15 (comment)>,
>> or mute the thread
>> <https://github.com/notifications/unsubscribe-auth/ASyR4UpMsc2RDqI9kmhgOhwJYa8USfuiks5slmKxgaJpZM4OFZJX>
>> .
>>
>
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Looks like status is not copied from first vertex in VertexMergerGroup constructor.
addVertex preserves only "constraint member" status during addition. Synthetic flag should be reset when adding non synthetic node. (this is very rare)
Martin
24. 9. 2017 v 23:20, gwlucastrig <notifications@github.com>:
… Made some progress on issue #15 today. I will do some more testing and
then post code.
The new code will change the way constraints are processed. As you know,
when a closed polygon constraint is added, its first and last vertices will
have the same coordinates. The PolygonConstraint class' method called
complete() ensures that this requirement is met. If the input geometry
does not include a "closure vertex" (my terminology for the case where the
first vertex has the same coordinates as the last vertex), it simply copies
the first vertex in the constraint onto its end. In your case, you'd
already supplied a closure vertex, so the complete() method did nothing.
The Tinfour code got confused, however, because your closure vertex was a
different object than your first vertex. In all my testing, I always used
the same object. You did something a little different than I did (a little
different... but correct nevertheless... the code should have handled it).
I hope to have the updates posted tonight (my time). If testing takes a
little longer, I'll let you know.
I still haven't looked at your other test data yet.
Gary
On Sun, Sep 24, 2017 at 12:46 PM, Gary Lucas ***@***.***>
wrote:
> Thanks for the updates. Am reviewing the issues and will inform you when
> I have fixes.
>
> On Sun, Sep 24, 2017 at 10:09 AM, Martin JANDA ***@***.***>
> wrote:
>
>> Here data are valid. No segment intersections, ...
>>
>> —
>> You are receiving this because you commented.
>> Reply to this email directly, view it on GitHub
>> <#15 (comment)>,
>> or mute the thread
>> <https://github.com/notifications/unsubscribe-auth/ASyR4UpMsc2RDqI9kmhgOhwJYa8USfuiks5slmKxgaJpZM4OFZJX>
>> .
>>
>
>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Well, that's just what the problem was: the first and last vertices were
not properly merged. That's fixed now.
I pushed my changes up to the github site. I haven't tested them as well
as I wanted. I pushed them to the page so that they'd be available for you.
I suggest you make a safe copy of what you get before you pull in my latest
changes. I will continue working on them tomorrow.
One consequence of the changes I had to make is that the constraints that
end up in the TIN are not always the same objects as an application
supplies, but may be copies of them with slightly altered vertices
(including the merger groups). I cannot think of cases where this would
matter, but of course there must be some that I haven't anticipated. To
obtain a list of the actual constraint objects stored in the tin, call the
getConstraints() method.
On Sun, Sep 24, 2017 at 6:59 PM, Martin JANDA <notifications@github.com>
wrote:
… Looks like status is not copied from first vertex in VertexMergerGroup
constructor.
addVertex preserves only "constraint member" status during addition.
Should be new status ORed with current value from merger group?
Martin
24. 9. 2017 v 23:20, gwlucastrig ***@***.***>:
> Made some progress on issue #15 today. I will do some more testing and
> then post code.
>
> The new code will change the way constraints are processed. As you know,
> when a closed polygon constraint is added, its first and last vertices
will
> have the same coordinates. The PolygonConstraint class' method called
> complete() ensures that this requirement is met. If the input geometry
> does not include a "closure vertex" (my terminology for the case where
the
> first vertex has the same coordinates as the last vertex), it simply
copies
> the first vertex in the constraint onto its end. In your case, you'd
> already supplied a closure vertex, so the complete() method did nothing.
>
> The Tinfour code got confused, however, because your closure vertex was a
> different object than your first vertex. In all my testing, I always used
> the same object. You did something a little different than I did (a
little
> different... but correct nevertheless... the code should have handled
it).
>
>
> I hope to have the updates posted tonight (my time). If testing takes a
> little longer, I'll let you know.
>
> I still haven't looked at your other test data yet.
>
> Gary
>
> On Sun, Sep 24, 2017 at 12:46 PM, Gary Lucas ***@***.***>
> wrote:
>
> > Thanks for the updates. Am reviewing the issues and will inform you
when
> > I have fixes.
> >
> > On Sun, Sep 24, 2017 at 10:09 AM, Martin JANDA <
***@***.***>
> > wrote:
> >
> >> Here data are valid. No segment intersections, ...
> >>
> >> —
> >> You are receiving this because you commented.
> >> Reply to this email directly, view it on GitHub
> >> <#15#
issuecomment-331712583>,
> >> or mute the thread
> >> <https://github.com/notifications/unsubscribe-auth/
ASyR4UpMsc2RDqI9kmhgOhwJYa8USfuiks5slmKxgaJpZM4OFZJX>
> >> .
> >>
> >
> >
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub, or mute the thread.
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ASyR4UI9oH2fMP7WJaf0swcuERhj3PKeks5slt7WgaJpZM4OFZJX>
.
|
Also, I am still looking at the constraint-member flag. That operation is not correct yet. It is close. But not complete. |
I believe that the constraint member flag is now populated correctly when a merger group is constructed. I also followed your suggestion for the addVertex() logic. If a non-synthetic vertex is added to a merger group that has a synthetic status, the group is set to non-synthetic. This is a bit of a tricky issue, but it appears to be supported by the addConstraints() method. |
Here are my proposed fix from July 7th. Modified is only SemiVirtualIncrementalTIN. I introduced mergeID to Vertex. mergeID is index to coincidenceList and is set when vertex is added to vertex group. After adding all constraints merged vertices are replaced directly with its group in constraint vertex list. Another change is that I introduced TIN_MEMBER flag. It was discussed earlier and refused by you. |
Thanks for the code. I will review it tonight.
…On Sep 25, 2017 3:19 AM, "Martin JANDA" ***@***.***> wrote:
Here are my proposed fix from July 7th. Modified is only
SemiVirtualIncrementalTIN. I introduced mergeID to Vertex. mergeID is index
to coincidenceList and is set when vertex is added to vertex group. After
adding all constraints merged vertices are replaced directly with its group
in constraint vertex list. Another change is that I introduced TIN_MEMBER
flag. It was discussed earlier and refused by you.
tinfour-fix-jandam.zip
<https://github.com/gwlucastrig/Tinfour/files/1328506/tinfour-fix-jandam.zip>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#15 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ASyR4RTpovMFUjqxxbC5lGpqSKwo35dRks5sl1PsgaJpZM4OFZJX>
.
|
I looked at the code. I am trying to figure out the best solution based on your needs. I have a question about the TIN_MEMBER flag. But I'd like to talk about the constraint geometry first. Your solution updates the geometry of the constraint objects that were passed in to the TIN. My version tries to leave the constraint objects unchanged. The reason behind this was that I thought it possible that an application might use the constraints in multiple TINs or in parallel threads. To make it work, I create a separate list of constraint objects internal to the TIN object. Some of these objects may be the original ones that you passed in, some may be "copy objects" with the geometry updated to include the merge vertices. So if you want the true list of constraints that are stored in the TIN, you have to call the getConstraints() method. I'll have to make a note about this in the Javadoc. Also, I've avoided using an additional mergeID field to the Vertex class. I am reluctant to do so because the field would increase the size of the vertex object by 8 bytes (4 for the integer size, 4 for Java memory padding). But that leads to a question. Is there a reason that you would need the mergeID for your own application? Also, in the discussion before, I talked about how the TIN_MEMBER flag might have problems because the TIN class would probably be better if it did not alter vertex objects when they are added to the TIN. Also, a single vertex can be added to multiple tins. So while the "add" methods for the TIN classes could set a TIN_MEMBER flag, the TIN classes can never reliably clear them (if, for example, a TIN object goes out-of-scope). That leads me to another question. How do you foresee your application using a TIN_MEMBER flag? If you tell me about your anticipated use for the TIN_MEMBER flag, and I can think of a way of supporting your function without interfering with other Tinfour actions, I'll introduce it to the code base. If I can't make that work, you can always create your own derived classes from Vertex and SemiVirtualIncrementalTin to manage it. VertexJanda could use the Vertex.reserved2 field to store information. Once you added vertices and constraints to a TIN, you could call the getVertices() method, get all the vertices in the TIN, loop through them and set the flags. Alternately, you could derive a new SemiVirtualIncrementalTinJanda class that overrides the add() and remove(), and clear() methods to manage the TIN membership flags. But I think the getVertices() method is probably safer. Gary |
Idea behind TIN_MEMBER and mergeID is performance improvement.
I can skip all vertices already processed by tinfour. It's O(1) to check already processed vertex. Skipping all walks through tin.
With mergeID I can recognize multiple vertices on same position. Also I suppose that my code is independent on order of constraints. Because in first step all duplicated vertices are merged. In second step replacements are populated to constraints.
So far I did not consider reusing constraints by multiple threads. It's good idea that I want to try. I have JTS Geometry that I convert to tinfour constraint.
I have following priorities:
1) perfectly working algorithm
2) optimization for speed and memory consumption
3) optimization for storage
Today I made some preliminary tests with TIN storage. I process data in tiles. straw man storage format (Java serialization) requires 2.5-100MB / tile. 100MB is extreme - contour lines with 1m step. It is not really efficient because I have 40-70% redundat triangles that are out of tile bounds. I h
I suppose that Vertex objects can be replaced with primitive arrays to save memory. Contours have constant height/constraints so this can be used to save memory (reuse height)
Martin
25. 9. 2017 v 22:15, gwlucastrig <notifications@github.com>:
… I looked at the code. I am trying to figure out the best solution based on your needs. I have a question about the TIN_MEMBER flag. But I'd like to talk about the constraint geometry first.
Your solution updates the geometry of the constraint objects that were passed in to the TIN. My version tries to leave the constraint objects unchanged. The reason behind this was that I thought it possible that an application might use the constraints in multiple TINs or in parallel threads. To make it work, I create a separate list of constraint objects internal to the TIN object. Some of these objects may be the original ones that you passed in, some may be "copy objects" with the geometry updated to include the merge vertices. So if you want the true list of constraints that are stored in the TIN, you have to call the getConstraints() method. I'll have to make a note about this in the Javadoc.
Also, I've avoided using an additional mergeID field to the Vertex class. I am reluctant to do so because the field would increase the size of the vertex object by 8 bytes (4 for the integer size, 4 for Java memory padding). But that leads to a question. Is there a reason that you would need the mergeID for your own application?
Also, in the discussion before, I talked about how the TIN_MEMBER flag might have problems because the TIN class would probably be better if it did not alter vertex objects when they are added to the TIN. Also, a single vertex can be added to multiple tins. So while the "add" methods for the TIN classes could set a TIN_MEMBER flag, the TIN classes can never reliably clear them (if, for example, a TIN object goes out-of-scope).
That leads me to another question. How do you foresee your application using a TIN_MEMBER flag?
If you tell me about your anticipated use for the TIN_MEMBER flag, and I can think of a way of supporting your function without interfering with other Tinfour actions, I'll introduce it to the code base. If I can't make that work, you can always create your own derived classes from Vertex and SemiVirtualIncrementalTin to manage it. VertexJanda could use the Vertex.reserved2 field to store information. Once you added vertices and constraints to a TIN, you could call the getVertices() method, get all the vertices in the TIN, loop through them and set the flags. Alternately, you could derive a new SemiVirtualIncrementalTinJanda class that overrides the add() and remove(), and clear() methods to manage the TIN membership flags. But I think the getVertices() method is probably safer.
Gary
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Dealing with concurrency issues is a challenge in any computer language. In fact, I think its the hardest thing we programmer's do. One technique for simplifying concurrency issues in Java is to make all the elements in an object final. That way, an application can pass the objects around at will without ever worrying about concurrent-modification or synchronization overhead. Unfortunately, I didn't follow this guideline in the Vertex class. The status flag is modified when the vertex is added to a constraint. The index field is modified by the HilbertSort (I tried really hard to avoid that one, but couldn't think of any solution that didn't involve the need for me to write my own sort routine). Anyway, I'm thinking now that the code that allows the status field to be modified was a mistake. I should have made it final and had it be set as part of the constructor (getting rid of the setConstraintMember() method). I looked through the Tinfour code and see that nothing in the package itself that would be broken if I did that. Would that negatively affect your code? The "reserved" fields would still remain mutable with the assumption that the application code would manage any concurrency issues as necessary for its own purposes. Unfortunately, I don't think there's much I can do about the index unless I completely refactor the HilbertSort. |
The problematic merge-group issues have been corrected. Therefore I am closing this issue. If you would like to discuss the additional issues that were raised in this series of comments, please feel free to open a new issue. Thank you for identifying this problem and helping to improve the Tinfour code. |
*) List of polygon constraints in meters. nominalPointSpacing = 10.0m
*) 1 constraint has 2 vertices at index 78 and 79 with distance 1e-9. They are correctly merged in VertexMergerGroup when adding as vertex.
*) during processConstraint VertexMergerGroup is not recognized for vertex at in 78 and 79.
*) processConstraint throws ISE.
https://github.com/gwlucastrig/Tinfour/blob/master/src/main/java/tinfour/semivirtual/SemiVirtualIncrementalTin.java#L1979
Everything works correctly when I process failing polygon constrain separately.
I have to prepare minimal test case.
The text was updated successfully, but these errors were encountered: