RSS/Atom feed Twitter
Site is read-only, email is disabled

A better way to close a path where an end node is on top of a start node

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

15 of 17 messages available
Toggle history

Please log in to manage your subscriptions.

A better way to close a path where an end node is on top of a start node ugajin 29 Jan 13:53
  1454156634061.710746341@boxbe 31 Jan 16:54
   A better way to close a path where an end nodeis on top of a start node Joseph Bupe 31 Jan 08:08
    A better way to close a path where an end nodeis on top of a start node Ofnuts 31 Jan 23:04
     1454285312006.960626117@boxbe 05 Feb 18:07
      A better way to close a path where an endnodeis on top of a start node Joseph Bupe 01 Feb 06:29
       A better way to close a path where an endnodeis on top of a start node Burnell West 05 Feb 18:57
     A better way to close a path where an end nodeis on top of a start node Gez 31 Jan 23:58
  A better way to close a path where an end node is on top of a start node Sven Claussner 30 Jan 12:04
  A better way to close a path where an end node is on top of a start node Ofnuts 31 Jan 23:14
   A better way to close a path where an end node is on top of a start node Simon Budig 31 Jan 23:27
    A better way to close a path where an end node is on top of a start node ugajin@talktalk.net 01 Feb 10:55
     A better way to close a path where an end node is on top of a start node Simon Budig 01 Feb 11:17
      A better way to close a path where an end node is on top of a start node Simon Budig 01 Feb 11:23
       A better way to close a path where an end node is on top of a start node Ofnuts 01 Feb 22:26
      A better way to close a path where an end node is on top of a start node ugajin@talktalk.net 02 Feb 09:48
   A better way to close a path where an end node is on top of a start node ugajin@talktalk.net 01 Feb 10:54
ugajin
2016-01-29 13:53:06 UTC (about 8 years ago)

A better way to close a path where an end node is on top of a start node

I have been searching for how best to close a path where an end node is on top of a start node.

One work-around is to not place the end node on the start node, so that the path can be closed in the usual way, and then move what had been intended to be the end node on top of the start node. This hack will create a path segment between the start end and nodes with the expected zero values, but it will be a closed path.

Not closing path nodes may not always create an issue when using paths to generate bitmapped images, but it may when e.g. stroking paths, and the otherwise unnecessary data can be a tad messy when exporting paths.

Another workaround (good for OCD types) is perhaps to place the end node on the start node, export and edit the path data adding a close-path flag, and then import it back into Gimp.

Perhaps there is a better way?

Sven Claussner
2016-01-30 12:04:15 UTC (about 8 years ago)

A better way to close a path where an end node is on top of a start node

On 29.1.2016 at 2:53 PM Ugajin wrote:

I have been searching for how best to close a path where an end node is on top of a start node.

Hi,

what exactly are you trying to achieve with this method? I also think this is rather a question for the gimp-user list than the developer list.

Greetings

Sven

Joseph Bupe
2016-01-31 08:08:01 UTC (about 8 years ago)

A better way to close a path where an end nodeis on top of a start node

Hi,

Is there a reason why the path can close by just clicking the last node onto the first node? Why do we have to CTRL or Command + Click ?

On 30 January 2016 at 14:04, Sven Claussner wrote:

[image: Boxbe] This message is eligible for Automatic Cleanup! (scl.gplus@gmail.com) Add cleanup rule

| More info

On 29.1.2016 at 2:53 PM Ugajin wrote:

I have been searching for how best to close a path where an end node is on top of a start node.

Hi,

what exactly are you trying to achieve with this method? I also think this is rather a question for the gimp-user list than the developer list.

Greetings

Sven

_______________________________________________ gimp-developer-list mailing list
List address: gimp-developer-list@gnome.org List membership:
https://mail.gnome.org/mailman/listinfo/gimp-developer-list List archives: https://mail.gnome.org/archives/gimp-developer-list

D/Insp. BUPE Joseph
*Data Protection Officer, INTERPOL NCB Lusaka*


*Zambia Police Service Headquarters,*
*Criminal Investigation Department,**P.O. Box 50104, Lusaka*
*Zambia*

*Officer Phone/Fax*: + 260 211 255218
Ofnuts
2016-01-31 23:04:18 UTC (about 8 years ago)

A better way to close a path where an end nodeis on top of a start node

On 31/01/16 09:08, Joseph Bupe wrote:

Hi,

Is there a reason why the path can close by just clicking the last node onto the first node? Why do we have to CTRL or Command + Click ?

Because clicking on a node is selecting it, and this i something you'll want to do if you want to extend the path from the other end. In other words, you create a path with M, N, O, P, Q and then you want to add points L, K, J, so after adding Q you'll click on M, and you don't want this to close the stroke.

Ofnuts
2016-01-31 23:14:31 UTC (about 8 years ago)

A better way to close a path where an end node is on top of a start node

On 29/01/16 14:53, ugajin wrote:

I have been searching for how best to close a path where an end node is on top of a start node.

One work-around is to not place the end node on the start node, so that the path can be closed in the usual way, and then move what had been intended to be the end node on top of the start node. This hack will create a path segment between the start end and nodes with the expected zero values, but it will be a closed path.

Not closing path nodes may not always create an issue when using paths to generate bitmapped images, but it may when e.g. stroking paths, and the otherwise unnecessary data can be a tad messy when exporting paths.

Another workaround (good for OCD types) is perhaps to place the end node on the start node, export and edit the path data adding a close-path flag, and then import it back into Gimp.

If you are doing this in a script:

* copy the backwards tangent of the last node to the first node * drop the last node and its tangent handles * mark the stroke closed

Simon Budig
2016-01-31 23:27:01 UTC (about 8 years ago)

A better way to close a path where an end node is on top of a start node

Ofnuts (ofnuts@gmx.com) wrote:

If you are doing this in a script:

* copy the backwards tangent of the last node to the first node * drop the last node and its tangent handles * mark the stroke closed

or use gimp_vectors_stroke_close.

Bye, Simon

simon@budig.de              http://simon.budig.de/
Gez
2016-01-31 23:58:17 UTC (about 8 years ago)

A better way to close a path where an end nodeis on top of a start node

El lun, 01-02-2016 a las 00:04 +0100, Ofnuts escribió:

On 31/01/16 09:08, Joseph Bupe wrote:

Hi,

Is there a reason why the path can close by just clicking the last node
onto the first node? Why do we have to CTRL or Command + Click ?

Because clicking on a node is selecting it, and this i something you'll 
want to do if you want to extend the path from the other end. In other 
words, you create a path with M, N, O, P, Q and then you want to add  points L, K, J, so after adding Q you'll click on M, and you don't want 
this to close the stroke.

Double clicking on the first node could work too. But that in that case selecting the first node with a single click should revert the behavior, allowing to close the path double clicking the final node of the other end of the path.

G.

Joseph Bupe
2016-02-01 06:29:43 UTC (about 8 years ago)

A better way to close a path where an endnodeis on top of a start node

But that in that case selecting the first node with a single click should revert the behavior, allowing to close the path double clicking the final node of the other end of the path.

G.

Sounds reasonable. Double clicking the final node should close the path. It's more discoverable than than using CTRL + Click.

ugajin@talktalk.net
2016-02-01 10:54:53 UTC (about 8 years ago)

A better way to close a path where an end node is on top of a start node

Ofnuts - I shall need more help with doing this using a script.

----Original Message----
From: ofnuts@gmx.com
Date: 31/01/2016 23:14
To:
Subj: Re: [Gimp-user] A better way to close a path where an end node

is on top of a start node

On 29/01/16 14:53, ugajin wrote:

I have been searching for how best to close a path where an end node

is on top of a start node.

One work-around is to not place the end node on the start node, so

that the path can be closed in the usual way, and then move what had been intended to be the end node on top of the start node. This hack will create a path segment between the start end and nodes with the expected zero values, but it will be a closed path.

Not closing path nodes may not always create an issue when using

paths to generate bitmapped images, but it may when e.g. stroking paths, and the otherwise unnecessary data can be a tad messy when exporting paths.

Another workaround (good for OCD types) is perhaps to place the end

node on the start node, export and edit the path data adding a close- path flag, and then import it back into Gimp.

If you are doing this in a script:

* copy the backwards tangent of the last node to the first node * drop the last node and its tangent handles * mark the stroke closed

_______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list

List archives: https://mail.gnome.org/archives/gimp-user-list

ugajin@talktalk.net
2016-02-01 10:55:01 UTC (about 8 years ago)

A better way to close a path where an end node is on top of a start node

Simon - I don't see how this will work in the scenario described.

----Original Message----
From: simon@budig.de
Date: 31/01/2016 23:27
To:
Subj: Re: [Gimp-user] A better way to close a path where an end node

is on top of a start node

Ofnuts (ofnuts@gmx.com) wrote:

If you are doing this in a script:

* copy the backwards tangent of the last node to the first node * drop the last node and its tangent handles * mark the stroke closed

or use gimp_vectors_stroke_close.

Bye, Simon

--
simon@budig.de http://simon.budig.de/ _______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list

List archives: https://mail.gnome.org/archives/gimp-user-list

Simon Budig
2016-02-01 11:17:53 UTC (about 8 years ago)

A better way to close a path where an end node is on top of a start node

ugajin@talktalk.net (ugajin@talktalk.net) wrote:

Simon - I don't see how this will work in the scenario described.

We're talking about programmatically constructing a stroke within a vectors object, that has its end node placed on the start node and then is supposed to be closed. right?

I started a new gimp instance and issued the following commands in the script fu console:

(gimp-image-list)

(1 #(1))

(gimp-vectors-new 1 "testpath")

(3)

(gimp-image-insert-vectors 1 3 0 0)

(#t)

(gimp-vectors-bezier-stroke-new-moveto 3 100 100)

(1)

(gimp-vectors-bezier-stroke-cubicto 3 1 150 100 200 150 200 200)

(#t)

(gimp-vectors-bezier-stroke-cubicto 3 1 150 200 100 150 100 100)

(#t)

(gimp-vectors-stroke-get-points 3 1)

(0 18 #(100.0 100.0 100.0 100.0 150.0 100.0 200.0 150.0 200.0 200.0 150.0 200.0 100.0 150.0 100.0 100.0 100.0 100.0) 0)

(gimp-vectors-stroke-close 3 1)

(#t)

(gimp-vectors-stroke-get-points 3 1)

(0 12 #(100.0 150.0 100.0 100.0 150.0 100.0 200.0 150.0 200.0 200.0 150.0 200.0) 1)

This is constructing a path with two bezier segments, where the end of the last segment coincides with the start of the first segment.

As you can see gimp-vectors-stroke-close reduced the number of points: Gimp has determined, that the first and the last control point are on top each other and that their respective control handles do not hold relevant information (since their coordinates are identical with the anchor handle).

So the final result after the stroke-close contains exactly six handles (i.e. the coordinate array contains 12 elements). Which IMHO is the desired result.

I hope this helps, Simon

simon@budig.de              http://simon.budig.de/
Simon Budig
2016-02-01 11:23:05 UTC (about 8 years ago)

A better way to close a path where an end node is on top of a start node

Simon Budig (simon@budig.de) wrote:

ugajin@talktalk.net (ugajin@talktalk.net) wrote:

Simon - I don't see how this will work in the scenario described.

We're talking about programmatically constructing a stroke within a vectors object, that has its end node placed on the start node and then is supposed to be closed. right?

Sorry, I forgot to add that I tested this with a version where I have changed how moveto/cubicto/closepath work, i.e. for you the order of the coordinates might be different (and I promptly discovered a bug in my changes).

But the closepath-optimization is in the older gimp versions available as well and should work the same for you.

Bye, Simon

simon@budig.de              http://simon.budig.de/
Ofnuts
2016-02-01 22:26:51 UTC (about 8 years ago)

A better way to close a path where an end node is on top of a start node

On 01/02/16 12:23, Simon Budig wrote:

But the closepath-optimization is in the older gimp versions available as well and should work the same for you.

Yes it does. Good to know.

ugajin@talktalk.net
2016-02-02 09:48:17 UTC (about 8 years ago)

A better way to close a path where an end node is on top of a start node

In a sense it may.

Thanks.

----Original Message----
From: simon@budig.de
Date: 01/02/2016 11:17
To:
Subj: Re: [Gimp-user] A better way to close a path where an end node

is on top of a start node

ugajin@talktalk.net (ugajin@talktalk.net) wrote:

Simon - I don't see how this will work in the scenario described.

We're talking about programmatically constructing a stroke within a vectors object, that has its end node placed on the start node and

then

is supposed to be closed. right?

I started a new gimp instance and issued the following commands in the script fu console:

(gimp-image-list)

(1 #(1))

(gimp-vectors-new 1 "testpath")

(3)

(gimp-image-insert-vectors 1 3 0 0)

(#t)

(gimp-vectors-bezier-stroke-new-moveto 3 100 100)

(1)

(gimp-vectors-bezier-stroke-cubicto 3 1 150 100 200 150 200 200)

(#t)

(gimp-vectors-bezier-stroke-cubicto 3 1 150 200 100 150 100 100)

(#t)

(gimp-vectors-stroke-get-points 3 1)

(0 18 #(100.0 100.0 100.0 100.0 150.0 100.0 200.0 150.0 200.0 200.0 150.0 200.0 100.0 150.0 100.0 100.0 100.0 100.0) 0)

(gimp-vectors-stroke-close 3 1)

(#t)

(gimp-vectors-stroke-get-points 3 1)

(0 12 #(100.0 150.0 100.0 100.0 150.0 100.0 200.0 150.0 200.0 200.0 150.0 200.0) 1)

This is constructing a path with two bezier segments, where the end of the last segment coincides with the start of the first segment.

As you can see gimp-vectors-stroke-close reduced the number of points: Gimp has determined, that the first and the last control point are on top each other and that their respective control handles do not hold relevant information (since their coordinates are identical with the anchor handle).

So the final result after the stroke-close contains exactly six

handles

(i.e. the coordinate array contains 12 elements). Which IMHO is the desired result.

I hope this helps, Simon

--
simon@budig.de http://simon.budig.de/ _______________________________________________ gimp-user-list mailing list
List address: gimp-user-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list

List archives: https://mail.gnome.org/archives/gimp-user-list

Burnell West
2016-02-05 18:57:44 UTC (about 8 years ago)

A better way to close a path where an endnodeis on top of a start node

I think part of the complication on this arises from the behavior of the free select “lasso”, particularly when add-to-selection is active. It’s much like path creation in this mode.

I also think the double-click termination is reasonable.

On Jan 31, 2016, at 10:29 PM, Joseph Bupe wrote:

But that in that case selecting the first node with a single click should revert the behavior, allowing to close the path double clicking the final node of the other end of the path.

G.

Sounds reasonable. Double clicking the final node should close the path. It's more discoverable than than using CTRL + Click. _______________________________________________ gimp-developer-list mailing list
List address: gimp-developer-list@gnome.org List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list List archives: https://mail.gnome.org/archives/gimp-developer-list