Why is my "waterproof" polyhedron causing "WARNING: Object may not be a valid 2-manifold and may need repair!"? - openscad

In the script
difference() {
polyhedron(
points=[[0,0,0],
[2,0,0],
[2,1,0],
[0,1,0],
[0,0,2],
[0,1,2]],
faces=[[0,1,2,3],
[5,4,1,2],
[5,4,0,3],
[0,1,4],
[2,3,5]]);
cube([1,1,1]);
};
the polyhedron alone works fine (is rendered without warnings), but adding the cube above causes the warning WARNING: Object may not be a valid 2-manifold and may need repair! to be logged and the output to only render some parts of some surfaces.
I'm using OpenSCAD 2015.03-1 on Ubuntu 16.04.

This is because your polyhedron has some faces pointing into the wrong direction, causing issues when calculating the difference().
See the Manual and FAQ for details.
Changing the winding order of the affected polygons fixes the polyhedron:
difference() {
polyhedron(
points=[[0,0,0],
[2,0,0],
[2,1,0],
[0,1,0],
[0,0,2],
[0,1,2]],
faces=[[0,1,2,3],
[2,1,4,5],
[5,4,0,3],
[0,4,1],
[2,5,3]]);
cube([1,1,1]);
};
The difference is still non-manifold as cutting the cube results in 2 prism shaped objects just touching at one edge. That's also by definition not 2-manifold, so the warning remains.
Depending on how the exported model is supposed to be used, you could choose to ignore this warning and hope the tool processing the 3d model can handle that.
To remove the issue, for example the cube could be made a bit smaller like cube([1, 1, 0.999]).
An unrelated, but still useful strategy for preventing issues later on is to always make the cutting object a bit larger to ensure that no very thin planes remain, e.g. use cube([2,3,1.999], center = true). That will also remove the display artifacts in preview mode.

Related

Roblox - creating a multistory maze

I am trying to create a multistory maze. I found it fairly easy to create the first level, then I realized I had no idea how to simply raise this first level up in order to create a second level beneath it.
Also, is there a way to 'fuse' all of these wall parts into one object and then raise this object up?
Edit: Much to my embarrassment, their is a way to fuse objects. The 'Union' tool is what I needed, but had no idea existed. I 'fused' (unioned) the various parts that made up my walls and joined them together into one big part. After that unioning, moving the entire maze upwards became quite easy.
I don't understand your problem but I think that you're making a 3D maze in roblox and you want the first level to go up and the second level to form below the level.
If the maze is NOT procedurally generated AND the maps are built by hand. Then you can make the script detect if the player won, and then raise the first level by either using tween or using loops (I'd recommend tween because loops and linear tweening does the same), and then make an effect that shows it forming (Transparency, parts coming back together, etc..).
I will show you the simplest example. But you can add whatever you want
local ts = game:GetService("TweenService")
local ti = TweenInfo.new(0.5, Enum.TweenStyle.Linear, Enum.TweenDirection.Out) --Customize it to your liking
local levels = game.LevelStorageParent.LevelFolderOrModelHere:GetChildren()
local pos = workspace.Level1.Position --Change (Not the levels because we are not cloning this)
local levelYRaise = 10 --Put any number or just get bounding box for full raise
ts:Create(workspace.Level1, ti, {Position = Vector3.new(pos.X, pos.Y+levelYRaise, pos.Z):Play()
local newLevel = levels.Level2:Clone()
newLevel.Parent = workspace
newLevel.Pos = workspace.Level1.Position - Vector3.new(0, workspace.Level1.Size.Y, 0)
newLevel.Transparency = 1
ts:Create(newLevel, ti, {Transparency = 0}):Play()
Change the code to your liking and your hierarchy names and parenting

MIT-Scratch : Sequential cloning without delay

I am just starting to play with this as an educational tool for a youngster and encounter strange behavior whilst attempting to clone sprites.
I setup a global variable for position x,y in sprite_1 and clone a sprite_2 object. This object immediately copies the global x,y to local x,y and exits. Later sprite_2 renders using the stored local x,y.
sprite_1:
sprite_2:
I expect the four sprites to clone diagonally up/right on the screen according to this small reproduce-able example. Instead I appear to get four sprite_2 objects all on top of each other:
If I add a delay of 1 second onto the end of the clone(x,y) function however all is well:
As all four sprite_2 objects appear to be where the last clone was placed, I have a suspicion that the clones are not created immediately but instead created as a batch all at once, at some time and therefore are all taking the last coordinates from the globals _clone_enemy_x/y.
Is this the case? is there are way to circumvent this behavior or what is the solution?
I have 2 possible solutions to this problem:
Go to the "define clone()()" block, right click it, open up the advanced dropdown, and tick "run without screen refresh".
Get rid of the custom block all together, but use the original source for that block in the actual code.
I hope this helps!

Why do devices with 'ColorTemperature' trait in rooms receive commands for 'ColorSpectrum'?

To illustrate an example scenario that prompted this question, please consider the following:
A room, attic, that contains 3 devices: one light that supports both ColorSpectrum and ColorTemperature, one light that only supports ColorTemperature and one light that only supports ColorSpectrum (all 3 also support OnOff and Brightness, but this appears to be irrelevant).
"Set the attic to warm white" will result in two of the lights receiving a temperature value in Kelvin, whereas the third (which didn't support ColorTemperature) will receive an rgb/hsv color value approximating the correct hue of white.
Conversely: "Set the attic to red" will result in all 3 lights receiving an rgb/hsv color value (including the light that does not support the ColorSpectrum trait).
We are unsure how a light that supports only ColorTemperature is supposed to respond to an rgb/hsv value. This final scenario - after the light's failure to be able to execute the user's command - left us with 3 options to respond:
Lie and respond 'SUCCESS' for all 3 lights, "Ok, changing 3 lights to red."
Omit the third light from the response entirely, "Ok, changing 3 lights to red."
Respond with "notSupported" 'ERROR' for the third light, "Ok, changing 2 lights to red. That mode isn't available for the LIGHT_3."
Option 1 is clearly undesirable, incorrect feedback is worse than no feedback at all.
Option 2 is equivalent to 1, though it seems odd that Google Home should assume that a device omitted from a response was successfully processed.
Option 3 we deem unideal as well, as we expect the user may get bored of hearing that a certain light in their room is unable to change color when they might be perfectly aware of this fact. Our preference would go to a response of: "Ok, changing 2 lights to red." We feel that this communicates clearly that one light didn't change, without the potentially superfluous error message.
Our question, then, is how we might realize this?
Is the behavior listed above unintended (a bug)?
Is there some response that we are unaware of that can be used to communicate to Google Home that a device simply is not eligible for the provided execution?
Is the behavior listed above not experienced by others or the result of a mistake on our part?
Thank you for reading.
I'm going to check about this scenario as it might be a bug in which devices get commands when they shouldn't.
Canonically, option three may be undesirable but is the right implementation. Trying to ignore the command will also create a bad user experience as they receive an incorrect reply.

Sharpdx Direct3D10 How to edit pixels in texture?

I need to change certain pixels in a texture (Texture2D) using Sharpdx with dx10
Right now I got
Texture.Map(0, MapMode.Write, MapFlags.None, out stream);
but I get a "The parameter is incorrect." exception.
All solutions I find are for either dx9 or dx11 or something other then Sharpdx and the used methods don't exist in Sharpdx.Direct3D10, hopefully someone here knows how to do this simple task of editing a texture...

Turning on anti-aliasing in SWT

I've called gc.setAntialias(SWT.ON); and it does nothing. According to that method, it should work.
The Javadoc states:
Sets the receiver's anti-aliasing
value to the parameter, which must be
one of SWT.DEFAULT, SWT.OFF or SWT.ON.
It's not working for me, and I'm painting on a simple Canvas.
The following worked for me in an app I built and my guesses at when/how you have to do this.
So I created a new GC, set the Antialias as you did and then drew what I needed to with that gc object. The key is attaching it to the shell you will draw in.
GC gc = new GC(shell);
gc.setAntialias(SWT.ON);
//then I attach to LightweightSystem for testing.
LightweightSystem lws = new LightweightSystem(shell);
Other than that make sure you do this before you draw anything. If you have to call it afterwards maybe try calling a repaint or redraw of the entire space.
Sorry without more information I am not sure exactly what is wrong.
Following derBiggi's answer, you ca also force the advanced option to true.
gc.setAdvanced(true)
Also, if you're drawing labels, make sure you use gc.setTextAntialias( SWT.ON );
You can also check if gc.getAdvanced() returns true, it should after setAntialias() or setTextAntialias was set.
Besides from that it's pretty straight forward.