PlayN: GroupLayer.add( layer) seems to ignore layer's depth attribute - playn

Suppose I have 4 layer, A,B,C,D with layer.depth() of 1, 4, 2, 3.
when I add the those layer to parent, by using groupLayer.add(layer), the index (ala, depth,) of them added seems to ignore the 'depth()' attribute and the result is according only to the order when I add them.
Not sure if it's a implementation bug or I have the wrong usage semantic.

I'm not sure this is your problem but it's definitely mine right now.
I'm pretty certain layer depth only obeys the depth value within a group.
If you nest groups (like for parts of a character), I think the layer(s) in higher level groups will always be drawn above the layer(s) in lower level groups.
I'm running into this issue now when trying to create a puppet-like character with lots of image layers arranged in a group layer hierarchy of body parts.
The torso needs to be at the top of the transformation hierarchy but some layers need to be drawn on top of the torso as well. Currently, I don't think you can do this with a single group layer hierarchy with image layers as children.

GroupLayer.add(layer, depth) has been deprecated. Instead you should use Layer.setDepth.

Related

How can I scale a glyph down vertically while keeping the vertical stroke widths the same (and not altering any of the horizontal dimensions)?

I'm using FontForge. I'm modifying the lower case q to make a straight-stalked 9. The q has 2 logical parts, the stalk, and the 'c'. The 'c' is too big vertically. How can I scale it down vertically while keeping the vertical stroke widths the same (and not altering any of the horizontal dimensions)?
I'm a novice with FontForge, so please spell out your explanation and provide step-by-step instructions. Thanks for your help.
It sounds like you want to decrease the x-height of the 'q' without changing stroke widths.
Font-forge provides a built-in tool to achieve this: Element > Styles > Change X-Height. You might like to experiment with this, but in practice it gives you very little control over the results and I would rarely use it.
Instead I would achieve this by directly modifying the nodes of the paths.
First, I would ensure that InterpolateCPsOnMotion is enabled. Double-click the pointer tool in your toolbox to access this setting.
This will help ensure that curves scale correctly (rather than distort) as you move control points. Now, I would select the nodes at the top and sides of the bowl of the q:
and use the down arrow key to move them down about half the distance you wish to decrease the height by. Then I would deselect the nodes at the side of the bowl:
and lower the remaining nodes the rest of the distance:
You will need to check the resulting appearance and possibly make tweaks to get it perfect. Note that this or any scaling technique can subtly distort the axis of modulated strokes, which you may wish to correct.
This technique presupposes that nodes are sensibly placed at the vertical and horizontal extrema of the bowl, and that you don't have extra nodes between these extrema. If you are not in this happy situation, you can add extrema by ctrl-shift-x and you can remove surplus nodes by selecting them and ctrl-m. If you can't remove extra nodes without significantly changing the shape of the bowl, you'll just have to modify these nodes by eye.
Another point: you say you're working from a "c". I'm not sure whether you just mean the C-shape of the bowl of the q, or whether you mean you are copying the actual glyph 'c'. Note that it is rare that the bowl of a 'q' will have exactly the same shape and weight as a 'c'. Typically the stroke will be somewhat lighter to achieve the right visual grey, and especial care will be taken where it intersects the stem. Often the two shapes will differ substantially.

How to make your graph wider in Dot?

I have a simple graph created with dot which represents simple neural network.
I want to make this graph wider, i.e. make more space between layers by elongating edges. I tried to do it with size and ratio attributes but without success. Ratio works for height, but I want to increase width.
In case anyone needs this later, I have solved my problem with variable ranksep.
Have you tried the nodesep variable?
GraphViz documentation
From the documentation it says "In dot, this specifies the minimum space between two adjacent nodes in the same rank, in inches." So depending on how you have your ranks set up, this might help you. The the look of your graph (lacking the .gv file), I'd guess that you're using invisible top-to-bottom ranks to align the vertical columns. If this, the nodesep variable may work well for you. The default is quite small, 0.25 inch.

SketchUp: dow to make a hole in a complex component?

I have a big cube made up of many smaller cubes. Theoretically, all surfaces should be paralei/perpendicular, but maybe I didn't alligh something (I can be sure). Also, each layer of my big cube is shifted with respect to the previous one by half of the length of side of the smaller cube. So the odd and the even layers are aligned, but an odd layer isn't alligned to an even layer.
I'd like to make s hole trougout the cube, The hole should intersect surfaces of the smaller cubes.
I've found numerous examples of how to make a hole in one component (using the push/pull tool): 1, 2, 3. However, I haven't found any information on how to deal with such a complex component . How can I make a hole throughout my cube?
The idea of creating a hole is to make a figure in form of the hole (for example, a long cylinder or parallelogram) and use it to create the hole.
After creating the figure, compose it to group (let's name it "hole" group) and move it into place of the hole. Make this group as subgroup of the target group. Then use intersect tool: select "hole" group and call "Intersect Faces / With Context" in context menu. After that it is need to delete unneeded parts in the target group.
Step by step solution:
Create a figure of the hole form, group it and give "hole" name.
Move "hole" into the place of the required hole.
Arrange "hole" as subgroup of the target group.
Intersect "hole" group with Context (i.e. parent group that is our target).
Remove unneeded parts in the target group.
The issue is that every subgroup should be edited separately, and to remove unneeded parts it is need to arrange "hole" into this subgroup and do intersection again.
To create inner surface of the hole we can use copy of the "hole" group as matter. Make copy, paste it in place, rename to "surface", arrange it into target group (if any). Then open "surface" group for edit, select all, call "Intersect Faces / With Model" in context menu. Note that intersection will be done with visible parts of the model only. After that delete unneeded parts in "surface" and optionally explode "surface" group. Use layers and hide/unhide tool to temporary hide interfering parts of the model.

Get Dicom image position into a sequence

A simple question as i am developing a java application based on dcm4che ...
I want to calculate/find the "position" of a dicom image into its sequence (series). By position i mean to find if this image is first, second etc. in its series. More specifically i would like to calculate/find:
Number of slices into a Sequence
Position of each slice (dicom image) into the Sequence
For the first question i know i can use tag 0020,1002 (however it is not always populated) ... For the second one?
If you are dealing with volumetric image series, best way to order your series is to use the Image Position (Patient) (0020, 0032). This is a required Type 1 tag (should always have value) and it is part of the image plane module. It will contain the X, Y and Z values coordinates representing the upper left corner of the image in mm. If the slices are parallel to each other, only one value should change between the slices.
Please note that the Slice Location (0020, 1041) is an optional (Type 3) element and it may not exist in the DICOM file.
We use the InstanceNumber tag (0x0020, 0x0013) as our first choice for the slice position. If there is no InstanceNumber, or if they are all the same, then we use the SliceLocation tag (0x0020, 0x1041). If neither tag is available, then we give up.
We check the InstanceNumber tag such that the Max(InstanceNumber) - Min(InstanceNumber) + 1 is equal to the number of slices we have in the sequence (just in case some manufacturers start counting at 0 or 1, or even some other number). We check the SliceLocation the same way.
This max - min + 1 is then the number of slices in the sequence (substitute for tag ImagesInAcquisition 0x0020, 0x1002).
Without the ImagesInAcquisition tag, we have no way of knowing in advance how many slices to expect...
I would argue that if the slice location is available, use that. It will be more consistent with the image acquisition. If it is not available, then you'll have to use or compute from the image position (patient) attribute. Part 3 section C.7.6.2.1 has details on these attributes.
The main issue comes when you have a series that is oblique. If you just use the z-value of the image position (patient), it may not change by the slice thickenss/spacing between slices attributes, while the slice location typically will. That can cause confusion to end users.

Is it possible to scale two.js groups in one direction

Two.js seems to only support a single value for a scale, not x,y components. Is it possible to just stretch something horizontally?
Yes, under the hood every Two.Group and Two.Polygon has a _matrix object. You can set _matrix.manual and then do a number of other transformations that you can't do with the typical two.js API. Check out this example for a demonstration.

Resources