HIShapeCreateDifference equivalent in cocoa - cocoa

I tried searching but couldn't find a function which can create a shape by calculating difference of two NSBezier Paths or two CGPaths. Is there a function that can establish this in cocoa ?
Thanks.

See "Winding Rules" with NSBezierPath. You'll make a compound path by appending your two source paths to it. The resulting shape will depend upon the winding rule you set.

Finally did it by creating a bigger tracking area to enclose the whole shape and then tracking mouse moved events inside this tracking area.

Related

Clear the current path in Cairo

In some Ruby code which uses Cairo, I need to draw a number of fills over a single path. This is part of a graphics application, where multiple fills may be stacked on top of each other using different blend modes.
Each fill is drawn using fill_preserve to preserve the path so that the next fill can occur over the same path without retracing it. This is done somewhat like so:
rectangle_data.each do |rectangle_datum|
context.rectangle(*rectangle_datum.rectangle)
fill_data.each do |fill_datum|
context.set_source_rgba(*fill_datum.color)
context.fill_preserve
end
end
The problem is that this leaves the path even after all fills have taken place, which means that individual shapes are just drawn as one huge filled shape.
To solve this, I'd simply need to clear the current path manually, but I can't figure out how to do this. I've had a look through the documentation for Cairo::Context through Google Translate but I can't find it. (The docs are in Japanese!)
How can I manually clear a Cairo context's current path?
I had a look over Cairo::Context#methods and found #new_path, which does just what I'm after. So you can do:
rectangle_data.each do |rectangle_datum|
context.rectangle(*rectangle_datum.rectangle)
fill_data.each do |fill_datum|
context.set_source_rgba(*fill_datum.color)
context.fill_preserve
end
context.new_path
end

Original skeleton position (Fbx import)

I was thinking that you need a deformer to read the clusters etc to be able to get the original (usually T pose) position of the skeleton.
Also FBX supports poses etc but never had a file that implemented it.
But my surprise was that importing an fbx file into 3dsmax without any mesh inside if I uncheck "animation" I get the T pose.
Any idea about it?
Thank you in adavnce
FbxCluster has GetTransformMatrix and GetTransformLinkMatrix. The former returns the original transform of the bone (that should be used to initialize the skinning), and the latter the corresponding orientation of the skinned node. Additionally, the skin node can also have "geometric rotation". I don't think there's anything more than that.

Find areas to output in pdf file

Problem: I have a scanned version of some tax report (e.g. https://docs.google.com/file/d/0B3TmJsb1vYhqclFFendvTlRoV28/edit?usp=sharing ), and I must fill it programmly. So, it`s needed to find empty areas and put to it some values in program.
Now I see only one solution - manually find coordinates of these empty areas, code it to program, and output values to these coordinates.
Is it possible to programmly find coordinates (may be by some pattern recognition or something else) of empty areas? May be use of some Ruby tools (e.g. Prawn) ?
So, there isn't complete automatic solution. I've solved this problem by searching areas to input, store its coordinates and then output to these areas

Problem using motion paths to move multiple objects in Expression Blend

I have a requirement where in I have to move four objects on an elliptical path.
Am using Expression Blend and was able to create a motion path quite very easily and place objects over it. It was also cool creating storyboards and keyframes.
The problem came when i wanted all the objects to move at once, their starting points being different. I mean I want the sarting point of each object to be different.
I have searched for answers but could find people ending up in creating their own custom paths through code behind.
Is there a way that we could achieve this through Expression Blend?
Thanks in advance,
Sri
What are you trying to do, exactly? If you are creating a Storyboard, why not just give each object a different starting location? If you are trying to create a Carousel or something like that, check out PathListBox. If neither of these are helpful, post some more specifics.

Automatic selection of control points in Matlab

Is there a way to select the control points automatically in Matlab instead of manually selecting them by cpselect? Thank you very much.
I just recently worked on a project where I had to do the same thing -- eventually I found that you can select control points automatically, but only if you use automatic selection to find the control points for both the unregistered and the orthophoto. (The control points used to define image transforms are stored in matrices, so if you can get your automated system to output a set of point coordinates in matrix form you can pass them to straight to cp2tform and bypass cpselect entirely.) On the other hand, cpselect stores corresponding pairs of image points using some kind of special data structure, so that I was never able to just pass it a set of control points for one image while leaving the other image blank.
I don't have the Matlab Image Processing Toolbox, but I see from the documentation that cpeselect can be called with an argument specifying the initial set of control points. Can you reduce your task to automating the creation of that initial set?

Resources