sbgn / libsbgn

Libraries for the Systems Biology Graphical Notation (SBGN); Java and C++
Other
15 stars 8 forks source link

Curved arcs #2

Closed cannin closed 8 years ago

cannin commented 14 years ago

Frank Bergmann: would it be possible to just include two optional points for the arcs, that will allow us to use nice looking Bezier curves? That really would make a difference for me ...

Reported by: amarillion

cannin commented 14 years ago

Original comment by: amarillion

cannin commented 14 years ago

Original comment by: amarillion

cannin commented 14 years ago

Frank also mentioned the possibility of defining arcs as list of segments (with segment = either a Bezier curve or a straight line)

It can be seen as an advanced version of the above suggestion (or is it a separate "bug"/missing feature to track?)

Original comment by: alice_villeger

cannin commented 14 years ago

Original comment by: amarillion

cannin commented 14 years ago

I'm copying the last proposal on the mailing list here, because it appears that most people like it

How about this: If we assume that a path goes from point to point, with at least one start point and one end point, and either straight or curved segments in between, then a path consisting of three straight edges can be defined like this:

<arc> <start x,y /> <line x,y /> <line x,y /> <line x,y /> </arc>

So the "start" tag defines the starting point, and each subsequent "line" goes from the previous point to the new point. This is how SVG paths work, as well as the Graphics2D API, so it would be really easy to implement. The start x,y is the start point of course, and the final line x,y is the end point, so start and end point are really easy to find. Here is how you would define a path with quadratic bezier curves:

<arc> <start x,y /> <quadratic x,y,x1,y1/> <quadratic x,y,x1,y1/> <quadratic x,y,x1,y1 /> </arc>

It's still easy to find the start and end point, so for less capable software it's easy to approximate the arc with a straight line. You can mix straight and curved segments:

<arc> <start x,y /> <straight x,y/> <quadratic x,y,x1,y1/> <straight x,y /> </arc>

Here is how you would define a single straight arc:

<arc> <start x,y /> <line x,y /> </arc>

You can even add cubic bezier curves easily:

<arc> <start x,y /> <cubic x,y,x1,y1,x2,y2/> <quadratic x,y,x1,y1/> <straight x,y /> </arc>

Original comment by: amarillion

cannin commented 14 years ago

Original comment by: amarillion

cannin commented 14 years ago

Assigning to alice, she has an example of mixed straight / curved arcs

Original comment by: amarillion

cannin commented 14 years ago

Original comment by: amarillion

cannin commented 13 years ago

Original comment by: alice_villeger