The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraphSketcher General (http://forums.omnigroup.com/forumdisplay.php?f=53)
-   -   Paste line and curve data to OmniGraphSketcher (http://forums.omnigroup.com/showthread.php?t=26674)

firefly 2012-10-28 08:43 PM

Paste line and curve data to OmniGraphSketcher
 
2 Attachment(s)
I write a AppleScript to parser my data which from my test program, and it could let OmniGraphSketcher draw my output path with line or curve.

For example with those data which generate from TTF font outline path.
Because OmniGraphSketcher's curve doesn't support to use bezier curve control pointer, so before output curve data from my program, I use the bezierat2() function to convert the control pointer to OmniGraphSketcher's control pointer in my program.

-- float bezierat2( float a, float b, float c, ccTime t )
-- {
-- t = 0.5f;
-- return (powf(1-t,2) * a + 2*t*(1-t)*b + powf(t,2)*c );
-- }

Copy those text and paste by my AppleScript to OmniGraphSketcher.

LineTo {(267.000000, 653.000000), (267.000000, 571.000000)}
CurveTo {(267.000000, 571.000000),(165.000000, 513.000000), (210.000000, 556.500000)}
CurveTo {(165.000000, 513.000000),(130.000000, 392.000000), (138.750000, 457.250000)}
CurveTo {(130.000000, 392.000000),(165.000000, 271.000000), (138.750000, 326.250000)}
CurveTo {(165.000000, 271.000000),(267.000000, 212.000000), (210.000000, 226.750000)}
LineTo {(267.000000, 212.000000), (267.000000, 130.000000)}
CurveTo {(267.000000, 130.000000),(95.000000, 216.000000), (169.000000, 151.500000)}
CurveTo {(95.000000, 216.000000),(40.000000, 392.000000), (53.750000, 297.000000)}
CurveTo {(40.000000, 392.000000),(95.000000, 571.000000), (53.750000, 489.250000)}
CurveTo {(95.000000, 571.000000),(267.000000, 653.000000), (169.000000, 632.500000)}

CurveTo {(267.000000, 653.000000),(442.000000, 571.000000), (367.250000, 632.500000)}
CurveTo {(442.000000, 571.000000),(497.000000, 392.000000), (483.250000, 489.250000)}
CurveTo {(497.000000, 392.000000),(442.000000, 216.000000), (483.250000, 295.000000)}
CurveTo {(442.000000, 216.000000),(267.000000, 130.000000), (367.250000, 151.500000)}
LineTo {(267.000000, 130.000000), (267.000000, 212.000000)}
CurveTo {(267.000000, 212.000000),(372.000000, 271.000000), (326.250000, 226.750000)}
CurveTo {(372.000000, 271.000000),(403.000000, 392.000000), (395.250000, 326.250000)}
CurveTo {(403.000000, 392.000000),(372.000000, 513.000000), (395.250000, 457.250000)}
CurveTo {(372.000000, 513.000000),(267.000000, 571.000000), (326.250000, 556.500000)}
LineTo {(267.000000, 571.000000), (267.000000, 653.000000)}



and could get the output in OmniGraphSketcher.
[IMG]http://forums.omnigroup.com/attachment.php?attachmentid=2615&stc=1&d=1351484836[/IMG]


All times are GMT -8. The time now is 12:19 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.