I am using Apple's Core Image Filter reference. It references:
"A CIVector class whose attribute type is CIAttributeTypeRectangle and whose display name is Rectangle."
I can't find anything anywhere that tells me anything about "attribute type is CIAttributeTypeRectangle" and what "display name is Rectangle." means.
Apple's docs (look under the CICrop Section)
It should probably say kCIAttributeTypeRectangle rather than CIAttributeTypeRectangle. It refers to:
kCIAttributeTypeRectangle
A Core Image vector that specifies the x and
y values of the rectangle origin, and the width (w) and height (h) of
the rectangle. The vector takes the form [x, y, w, h]. (A 4-element
vector type.)
See kCIAttributeTypeRectangle.
I believe whenever it talks about a "Display name", it's referring to the display name for that particular parameter in Quartz Composer.
Related
I read a shapefile using maptools package and then converted to .ppp
hfmd <- readShapeSpatial("NEWMERGE.shp")
hfmd2 <- as(hfmd, 'ppp')
When I typed hfmd2, I received this
Marked planar point pattern: 1092 points`
Mark variables: X, Y, Status, ID`
window: rectangle = [492623.7, 609905.3] x [444011.4, 645190.4] units`
And when I typed Gcross(hfmd2) to run Cross G function, I received this error
Error in marks.ppp(X, ...) :`
Sorry, not implemented when the marks are a data frame`
My questions are:
Does Gcross() only work with Multitype Marked planar point pattern object?
How do I convert a .ppp object to a Multitype Marked planar point pattern object?
Your current ppp has four different mark values: X, Y, Status, ID. Which one do you want to use for Gcross? For now I will assume it is Status. Then you can replace the data.frame containing the four mark values for each point with a single mark vector like this:
marks(hfmd2) <- marks(hfmd2)$Status
Now you should be able to run Gcross:
Gc <- Gcross(hfmd2)
This will estimate Gcross between the first two types in Status.
I've been reading the source code of the Haskell Chart package as I find the charts it creates are very good. But I'm stumped on how it works.
In particular, there is a type PickFn that is used by the render function:
type PickFn a = Point -> Maybe a
data Renderable a = Renderable {
minsize :: ChartBackend RectSize,
render :: RectSize -> ChartBackend (PickFn a)
}
class ToRenderable a where
toRenderable :: a -> Renderable ()
Commentary for PickFn is "A function that maps a point in device coordinates to some value." which unfortunately doesn't mean anything to me.
My ultimate goal is to be able to follow the code to learn how it draws its charts, but I'd like to start with "what is a pick function" so that I can at least understand the types.
The pick function is a convenience to the client of the Chart library - it lets you map back from a point in the resulting image to the thing (that's the Maybe a) at that position.
For example, Graphics.Rendering.Chart.Layout.layoutToRenderable returns a Renderable (LayoutPick x y y) so that you can map back from a point in the picture back to a specific component of the layout - its legend, an axis title, the plot area, etc.
I have the following for an HTML font tag:
data Color = HexColor Int | RGBColor Int Int Int | ColorString String deriving Show
data FontAttribute = Size Int | Face String | FontColor Color deriving Show
data Font = Font [FontAttribute] deriving Show
I construct one like so:
Font [Size 23,Face "Arial",Color (RGBColor 240 23 43)]
My concern is that the FontColor data/value constructor which has type FontAttribute requires a Color type as an argument. This means that Color is a generic type attribute for any kind of tag, and a specific tag has a specific subset of attributes (in this case Font has FontAttribute, which can be Size, Face or FontColor). Is there a clearer way to express this, or is my implementation sound?
Color is just a type, not an attribute. There is nothing in the type system to indicate that Color has any special relationship with FontAttribute. All that happens when you define the FontAttribute data type is that it creates a constructor called FontColor which is an ordinary function with the following type signature:
FontColor :: Color -> FontAttribute
So if you declared some new type called Link:
data LinkAttrubute = LinkColor Color | ...
Then Color could be stored in a LinkAttribute, too. A constructor does not imply an exclusive relationship with only that data type. All your FontAttribute data type says is that it MIGHT contain just a Color.
Haskell has no built-in concept of attributes because it has no built-in concept of objects. HOWEVER, you can model attributes using the Lens type from the data-lens (or fclabels) package. I would link you the packages, but I'm on my phone and it is difficult.
i m trying to get the x and y cordinate from the layout but when geting the layout from a VisualizationViewer the returned type is not staticLayout but ObservableCachingLayout (of course it couldn't be casted to static).
Is there a way to get the staticlayout from a VisualizationViewer ?
Or a way to get the x and y from the viz ? thx
To get the x and y coordinate from the Layout, you call layout.transform(vertex). (A Layout is a Transformer from vertices to Point objects.)
StaticLayout is an instance of Layout that allows the user to easily specify the coordinates of each vertex; it's intended for the case in which you already have coordinates and don't need an algorithm to determine them.
For example, if I have a 64-bit variable and store two 32-bit items of data in it, perhaps for the purposes of SIMD processing, is there a name to describe the logical coupling of those two items of data?
A colleague of mine suggests "Hybrid Coupling", is this a widely used term?
To clarify: we're after a higher level concept than specific implementations. Say, for example, in a C-like language we have these two structs:
struct CoupledData
{
uint64 x_and_y; // x is stored in the top 4 bytes, y in the bottom 4
}
struct UncoupledData
{
uint32 x;
uint32 y;
}
Regardless of the reasons for doing so, there is an implicit coupling between the x and y data members in CoupledData that doesn't exist in UncoupledData. Is there a term which describes this coupling between x and y?
I've always called it "packing." You pack R, G, B, and alpha bytes into a long.
pixel=(a<<24)+(r<<16)+(g<<8)+b;
Here's a reference for SIMD instructions in particular (from MMX/SSE):
ADDPS: Add Packed Single-Precision FP
Values
CMPccPS: Packed Single-Precision
FP Compare
In the c world its called a union
A "union declaration" specifies a set of variable values and, optionally, a tag naming the union. The variable values are called "members" of the union and can have different types. Unions are similar to "variant records" in other languages
A variable with union type stores one of the values defined by that type. The same rules govern structure and union declarations. Unions can also have bit fields.
In his example you would have this psuedocode:
union 32_64 {
64_bit_specifier sixty_four;
32_bit_specifier thirty_two;
}