ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TIELineLayer relationship to radius

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
NotTooSmart Posted - Jun 25 2021 : 15:19:27
Var c can have a range value, for example, from 8 to 0.02 See this statement:
TIELineLayer(ImageEnView1.CurrentLayer).Curve := c;

This produces an arc. My question is what is the math relationship between the c value and the radius of the arc created? Thanks for any advice.

Jorge
4   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Jun 29 2021 : 16:37:35
Hi Jorge

Min is defined in the Delphi math unit:

http://docwiki.embarcadero.com/Libraries/Sydney/en/System.Math.Min


Nigel
Xequte Software
www.imageen.com
NotTooSmart Posted - Jun 28 2021 : 13:21:54
Thanks Nigel,
When I tried to compile the function CalculateRadiusMultiplier... in the above message, it produced an error.
It did not recognize 'min' in midPt.x := min( Pt1.x, Pt2.x ) + abs( Pt1.x - Pt2.x ) div 2;
Please advice
Thanks

Jorge
xequte Posted - Jun 25 2021 : 22:41:24
This method may help:

// Given two points, and a point on the circle radius, return the multiplier (e.g. TIELineLayer.Curve)
// Result will be negative for inverted curves
function CalculateRadiusMultiplier(Pt1, Pt2, RadiusPt: TPoint; ForceHalfCircle: Boolean = False): Double;
var
  midPt: TPoint;
  abVect, azVect, ptDelta, rad: Double;
  isCW: Boolean;
begin
  midPt.x := min( Pt1.x, Pt2.x ) + abs( Pt1.x - Pt2.x ) div 2;
  midPt.y := min( Pt1.y, Pt2.y ) + abs( Pt1.y - Pt2.y ) div 2;

  abVect := IERadiansToDegrees( IEAngle2( Pt1.X, Pt1.y, Pt2.X, Pt2.Y  ));
  azVect := IERadiansToDegrees( IEAngle2( Pt1.X, Pt1.y, RadiusPt.X, RadiusPt.Y ));
  if abVect >= 180 then
    isCW := ( azVect > abVect ) or ( azVect < abVect - 180 )
  else
    isCW := ( azVect > abVect ) and ( azVect < abVect + 180 );

  ptDelta := IEDistPoint2Point( Pt1.X, Pt1.Y, Pt2.X, Pt2.Y );
  rad := IEDistPoint2Point( midPt.X, midPt.Y, RadiusPt.X, RadiusPt.Y );

  if ForceHalfCircle then
    Result := 1
  else
    Result := 1 / ( rad / ptDelta * 2 );
  if isCW then
    Result := -Result;
end;


Nigel
Xequte Software
www.imageen.com
xequte Posted - Jun 25 2021 : 20:37:01
Hi Jorge

Unfortunately there is not a precise relationship between c and radius.

c = 1: Creates a curve of an exact half circle.
c > 1: Creates a shallower curve.
c < 1: Creates a bulging curve.

Nigel
Xequte Software
www.imageen.com