Roassal bezier line error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Roassal bezier line error

Peter Uhnak
Hi,

it seems that last control point of a bezier line is off.
Here is a comparative view of RTBezierLine (black line) and bezier line done with SVG (red line). Notice how the bottom half is flatlined and doesn't match up.



And the code (based on RTRoassalExample>>exampleBezierCurve):

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| v e1 e2 l s p1 p2 path svg|
v := RTView new.

e1 := (RTEllipse new size: 15; color: (Color blue alpha: 0.4)) element.
e2 := (RTEllipse new size: 15; color: (Color blue alpha: 0.4)) element.
e2 translateBy: -150 @ 150.

p1 := RTBox element.
p2 := RTBox element.
p1 translateTo: (e2 position x + e1 position x / 2) @ e1 position y.
p2 translateTo: (e2 position x + e1 position x / 2) @ e2 position y.
v add: p1.
v add: p2.

s := RTBezierLine new.
s color: Color black.
s controllingElements: (Array with: p1 with: p2).
l := s edgeFrom: e1 to: e2.

v add: e1.
v add: e2.

v add: l.

path := 'M -150 150 Q -75 150 -75 75 Q -75 0 0 0'.
svg := RTSVGPath new borderColor: Color red; path: path; element.
v add: svg.

^ v
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Peter


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal bezier line error

abergel
Hi Peter!

This is a problem we have had for a while. I did not think about comparing it with the path. 
We will rewrite RTBezierLine to use TRSVGPath

We will let you know

Cheers,
Alexandre

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



On Apr 27, 2015, at 6:34 PM, Peter Uhnák <[hidden email]> wrote:

Hi,

it seems that last control point of a bezier line is off.
Here is a comparative view of RTBezierLine (black line) and bezier line done with SVG (red line). Notice how the bottom half is flatlined and doesn't match up.

<2015-04-28_00:29:16.png>

And the code (based on RTRoassalExample>>exampleBezierCurve):

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| v e1 e2 l s p1 p2 path svg|
v := RTView new.

e1 := (RTEllipse new size: 15; color: (Color blue alpha: 0.4)) element.
e2 := (RTEllipse new size: 15; color: (Color blue alpha: 0.4)) element.
e2 translateBy: -150 @ 150.

p1 := RTBox element.
p2 := RTBox element.
p1 translateTo: (e2 position x + e1 position x / 2) @ e1 position y.
p2 translateTo: (e2 position x + e1 position x / 2) @ e2 position y.
v add: p1.
v add: p2.

s := RTBezierLine new.
s color: Color black.
s controllingElements: (Array with: p1 with: p2).
l := s edgeFrom: e1 to: e2.

v add: e1.
v add: e2.

v add: l.

path := 'M -150 150 Q -75 150 -75 75 Q -75 0 0 0'.
svg := RTSVGPath new borderColor: Color red; path: path; element.
v add: svg.

^ v
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Peter

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal bezier line error

Pierre Chanson
Hi Peter,

the RTBezierLine has been fixed ! Load the last Roassal (with Trachel) and try again your code.

(ps: There is also the RTSVGPathBezierLine that works the same but use a generated SVG string to create the path.)

This post raised an interesting problem: the RTBezierLine is actually creating a serie of quadratic bezier lines. If you have 2 points of control between two points you will have two quadratic bezier lines instead of a real cubic
bezier line. If someone is interested in this I think it could be possible with some work to add this option.

thanks,

Pierre

2015-04-28 12:32 GMT-03:00 Alexandre Bergel <[hidden email]>:
Hi Peter!

This is a problem we have had for a while. I did not think about comparing it with the path. 
We will rewrite RTBezierLine to use TRSVGPath

We will let you know

Cheers,
Alexandre

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



On Apr 27, 2015, at 6:34 PM, Peter Uhnák <[hidden email]> wrote:

Hi,

it seems that last control point of a bezier line is off.
Here is a comparative view of RTBezierLine (black line) and bezier line done with SVG (red line). Notice how the bottom half is flatlined and doesn't match up.

<2015-04-28_00:29:16.png>

And the code (based on RTRoassalExample>>exampleBezierCurve):

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| v e1 e2 l s p1 p2 path svg|
v := RTView new.

e1 := (RTEllipse new size: 15; color: (Color blue alpha: 0.4)) element.
e2 := (RTEllipse new size: 15; color: (Color blue alpha: 0.4)) element.
e2 translateBy: -150 @ 150.

p1 := RTBox element.
p2 := RTBox element.
p1 translateTo: (e2 position x + e1 position x / 2) @ e1 position y.
p2 translateTo: (e2 position x + e1 position x / 2) @ e2 position y.
v add: p1.
v add: p2.

s := RTBezierLine new.
s color: Color black.
s controllingElements: (Array with: p1 with: p2).
l := s edgeFrom: e1 to: e2.

v add: e1.
v add: e2.

v add: l.

path := 'M -150 150 Q -75 150 -75 75 Q -75 0 0 0'.
svg := RTSVGPath new borderColor: Color red; path: path; element.
v add: svg.

^ v
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Peter

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal bezier line error

stepharo
In reply to this post by abergel


Le 28/4/15 17:32, Alexandre Bergel a écrit :
Hi Peter!

This is a problem we have had for a while. I did not think about comparing it with the path. 
We will rewrite RTBezierLine to use TRSVGPath
How the bezier is computed for TRSVGPath?

We will let you know

Cheers,
Alexandre

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



On Apr 27, 2015, at 6:34 PM, Peter Uhnák <[hidden email]> wrote:

Hi,

it seems that last control point of a bezier line is off.
Here is a comparative view of RTBezierLine (black line) and bezier line done with SVG (red line). Notice how the bottom half is flatlined and doesn't match up.

<2015-04-28_00:29:16.png>

And the code (based on RTRoassalExample>>exampleBezierCurve):

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| v e1 e2 l s p1 p2 path svg|
v := RTView new.

e1 := (RTEllipse new size: 15; color: (Color blue alpha: 0.4)) element.
e2 := (RTEllipse new size: 15; color: (Color blue alpha: 0.4)) element.
e2 translateBy: -150 @ 150.

p1 := RTBox element.
p2 := RTBox element.
p1 translateTo: (e2 position x + e1 position x / 2) @ e1 position y.
p2 translateTo: (e2 position x + e1 position x / 2) @ e2 position y.
v add: p1.
v add: p2.

s := RTBezierLine new.
s color: Color black.
s controllingElements: (Array with: p1 with: p2).
l := s edgeFrom: e1 to: e2.

v add: e1.
v add: e2.

v add: l.

path := 'M -150 150 Q -75 150 -75 75 Q -75 0 0 0'.
svg := RTSVGPath new borderColor: Color red; path: path; element.
v add: svg.

^ v
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Peter

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal bezier line error

abergel
In reply to this post by Peter Uhnak
Thanks Pierre to having fixed this!
Looks much better!

Peter, let us know whether you see other problem with the Bezier.

Alexandre


> On Apr 27, 2015, at 6:34 PM, Peter Uhnák <[hidden email]> wrote:
>
> Hi,
>
> it seems that last control point of a bezier line is off.
> Here is a comparative view of RTBezierLine (black line) and bezier line done with SVG (red line). Notice how the bottom half is flatlined and doesn't match up.
>
> <2015-04-28_00:29:16.png>
> ​
> And the code (based on RTRoassalExample>>exampleBezierCurve):
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | v e1 e2 l s p1 p2 path svg|
> v := RTView new.
>
> e1 := (RTEllipse new size: 15; color: (Color blue alpha: 0.4)) element.
> e2 := (RTEllipse new size: 15; color: (Color blue alpha: 0.4)) element.
> e2 translateBy: -150 @ 150.
>
> p1 := RTBox element.
> p2 := RTBox element.
> p1 translateTo: (e2 position x + e1 position x / 2) @ e1 position y.
> p2 translateTo: (e2 position x + e1 position x / 2) @ e2 position y.
> v add: p1.
> v add: p2.
>
> s := RTBezierLine new.
> s color: Color black.
> s controllingElements: (Array with: p1 with: p2).
> l := s edgeFrom: e1 to: e2.
>
> v add: e1.
> v add: e2.
>
> v add: l.
>
> path := 'M -150 150 Q -75 150 -75 75 Q -75 0 0 0'.
> svg := RTSVGPath new borderColor: Color red; path: path; element.
> v add: svg.
>
> ^ v
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Peter
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal bezier line error

abergel
In reply to this post by stepharo
Pierre fixed it nicely. Was a mistake I did.
The class TRSVGPath makes direct call to Athens. So Athens does all the job.

Cheers,
Alexandre


> On May 9, 2015, at 8:59 AM, stepharo <[hidden email]> wrote:
>
>
>
> Le 28/4/15 17:32, Alexandre Bergel a écrit :
>> Hi Peter!
>>
>> This is a problem we have had for a while. I did not think about comparing it with the path.
>> We will rewrite RTBezierLine to use TRSVGPath
> How the bezier is computed for TRSVGPath?
>>
>> We will let you know
>>
>> Cheers,
>> Alexandre
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>> On Apr 27, 2015, at 6:34 PM, Peter Uhnák <[hidden email]> wrote:
>>>
>>> Hi,
>>>
>>> it seems that last control point of a bezier line is off.
>>> Here is a comparative view of RTBezierLine (black line) and bezier line done with SVG (red line). Notice how the bottom half is flatlined and doesn't match up.
>>>
>>> <2015-04-28_00:29:16.png>
>>> ​
>>> And the code (based on RTRoassalExample>>exampleBezierCurve):
>>>
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> | v e1 e2 l s p1 p2 path svg|
>>> v := RTView new.
>>>
>>> e1 := (RTEllipse new size: 15; color: (Color blue alpha: 0.4)) element.
>>> e2 := (RTEllipse new size: 15; color: (Color blue alpha: 0.4)) element.
>>> e2 translateBy: -150 @ 150.
>>>
>>> p1 := RTBox element.
>>> p2 := RTBox element.
>>> p1 translateTo: (e2 position x + e1 position x / 2) @ e1 position y.
>>> p2 translateTo: (e2 position x + e1 position x / 2) @ e2 position y.
>>> v add: p1.
>>> v add: p2.
>>>
>>> s := RTBezierLine new.
>>> s color: Color black.
>>> s controllingElements: (Array with: p1 with: p2).
>>> l := s edgeFrom: e1 to: e2.
>>>
>>> v add: e1.
>>> v add: e2.
>>>
>>> v add: l.
>>>
>>> path := 'M -150 150 Q -75 150 -75 75 Q -75 0 0 0'.
>>> svg := RTSVGPath new borderColor: Color red; path: path; element.
>>> v add: svg.
>>>
>>> ^ v
>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>
>>> Peter
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>>
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev