[Drawkit] whoopsie...

Michael Caron michael.r.caron at gmail.com
Sun Apr 19 11:25:12 PDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

So is the result output of my experiment as the union should have  
been, given that the union of all object bounds isn't scaled by the  
same factor? It still seems way off to me.

Cheers,
Michael

On Apr 18, 2009, at 7:08 PM, Graham Cox wrote:

>
> On 19/04/2009, at 3:07 AM, Michael Caron wrote:
>
>> So I realized that my fix to the radius transform only took x into  
>> account, which is fine for a scale, but other transforms are left  
>> out.
>>
>> I am reworking it for calculating the hypotenuse instead.
>>
>> tbc...
>>
>
> Hi Michael,
>
> Looks like you found an oversight in DK - not unexpected I guess! Of  
> course one problem with DKArcPath is that it is inherently circular,  
> meaning it can't meaningfully be scaled by different x, y values...  
> you see the same effect when you distort one in a group and ungroup  
> it. I think using the hypoteneuse is a good compromise however. This  
> is what I do when ungrouping an arc path, where the transform  
> represents what the group has done to it:
>
> 	NSPoint loc = [self location];
> 	loc = [aTransform transformPoint:loc];
> 	
> 	NSSize radSize = NSMakeSize([self radius], [self radius]);
> 	radSize = [aTransform transformSize:radSize];
> 		
> 	[self setLocation:loc];
> 	[self setRadius:hypotf( radSize.width, radSize.height ) /  
> sqrtf( 2.0f )];
> 	[self setAngle:[self angle] + [aGroup angle]];
>
>
> On a general note, don't expect the unionOfAllObjectBounds method to  
> be exactly scaled by the same factor, though it should be close. The  
> reason is that the bounds of an object is its path bounds + some  
> fixed amount, and the union will be the union of these. The "fixed  
> amount" isn't scaled with the path bounds, because it depends on  
> style factors which don't change with scale.
>
> --Graham
>
>
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net

Michael
- ------------------------------------------------
michael.r.caron at gmail.com
http://techrad.wordpress.com
http://mrcaron.wordpress.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFJ62yJ5CEAr1NK/dQRAo92AJ42lYO+8576bsDM9try/+7mff8VagCfWC1p
9NbxFNnyPsI/+yZQz+WFjCA=
=+zXC
-----END PGP SIGNATURE-----


More information about the Drawkit mailing list