VPython: Why do scene.camera.pos and scene.camera.axis never change? - python-3.x

I was experimenting in VPython with my scene's camera and I discovered that scene.camera.pos is always equal to <0, 0, 1.73205> and scene.camera.axis is always equal to <0, 0, -1.73205>. These values don't change even when the camera auto-adjusts or when I use the scene.camera.follow function. Why is that? Also, I am able to change these values. However, for the scene.camera.pos it seems like going below 1 doesn't change anything from setting it to one. This is really odd and I hope someone can clear it up for me.

This has been addressed in the VPython forum:
https://groups.google.com/g/vpython-users

Related

Embedded IF AND Statements in Excel

I searched around on this site and found something similar to what I need, but I haven't been able to get it to work for me yet. I was able to get it to work when I do only half of it, but when I try to work in the other 2 conditions with AND statements, it gets messed up and I can't figure out what's going wrong.
The partial string of code that worked for me is this
=IF(M7>O7, IF(P7="R", 3, IF(P7="O", 2, IF)))
I have statements that would give different output...
If m7>o7 and p7="R" output a value of 3
If m7>o7 and p7="O" output a value of 2
If o7>m7 and p7="O" output a value of 1
If o7>m7 and p7="R" output a value of 0
Thanks in advance!
=IF(M7>O7,IF(P7="R",3,2),IF(P7="R",0,1))
Per the comment:
=IF(AND(M7<>"",O7<>"",P7<>""),IF(M7>O7,IF(P7="R",3,2),IF(P7="R",0,1)),"")

Capping a value in Excel using data validation

Wonder if someone can help?
I'm trying to cap a mark for an assignments spreadsheet if it is submitted late, or the attempt is more than 1. One exception is that it is submitted late, however their assignment was "Accepted - Late". I have checked all the references and all seem to be OK. It is not capping if G4 is blank but E4 is larger than F4, but it should and I can't see why it won't here.
As far as I can tell:
(is the work late (E4>F4)
AND is it Accepted late) if so, keep below 101, if not check if the work is late, if it is late then cap at 50, if not, check if attempt is more than 1, if it is cap at 50, if not cap at 101.
=IF(AND($E4>$F4, $G4="Accepted - Late"), $J4<101, IF($E4>$F4, $J4<51, IF($B4>1, $J4<51, $J4<101)))
After changing some formatting, this seemed to work, note some columns moved around.
=IF(AND($D3>$E3, F3="Accepted - Late"), $I3<101,IF(K3>1, $I3<41, IF($D3>$E3, $I3<41,$I3<101)))

modx Decrement a TV to obtain 0

I need my [[+idx]] tv to start at 0 instead of 1 so I tried this:
[[+idx:decr]] or [[+idx:substract=1]] but it gives me -1 (minus one).
Does anyone know another way to obtain 0?
Thank you
Using this in chunk for getImageList works (at least for me):
[[+idx:decr]]
It gives: 0,1,2,3 ....
P.S. using modx revo 2.3.1
set your template variable default to 0 when you create the variable.
What are you trying to do, your question is vague at best.
UPDATE
ok - what I think will work for you is to write a snippet to do the math... where ever you call the [[+idx]] instead write a snippet
[[!FixIDX? &itemindex=`[[+idx]]`]]
then in your FixIDX snippet just do the math with php and return the corrected index. Though perhaps a custom output modifier would be the better way to go: http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+(Output+Modifiers)
Though looking at the docs, your code should certainly work - I see no reason for it not to.

NSTextView will resize but parent NSScrollView not Resizing with setFrameSize

First let me say I'm coming from the iOS world and am trying to make my first OSX app. So apologies for the question if the answer is obvious. :)
I'm trying to setup an NSTextView to resize according to the amount of text in it. I've been successful at getting the NSTextView to resize properly but it's superview (NSScrollView) won't resize.
This is what I have so far...
[self.messageBodyTextView setVerticallyResizable:YES];
[self.messageBodyTextView.layoutManager ensureLayoutForTextContainer:self.messageBodyTextView.textContainer];
[self.messageBodyTextView.layoutManager boundingRectForGlyphRange:NSMakeRange(0, [self.messageBodyTextView.layoutManager numberOfGlyphs]) inTextContainer:self.messageBodyTextView.textContainer];
NSRect rect = [self.messageBodyTextView.layoutManager usedRectForTextContainer:self.messageBodyTextView.textContainer];
[self.messageBodyTextView.textContainer setContainerSize:rect.size];
[self.messageBodyTextView setMaxSize:NSMakeSize(self.messageBodyTextView.bounds.size.width, rect.size.height)];
[self.messageBodyTextView.textContainer setHeightTracksTextView:YES];
[self.messageBodyScrollView.documentView setFrameSize:rect.size];
[self.messageBodyScrollView.documentView setFrame:rect];
[self.messageBodyScrollView setFrameSize:rect.size];
self.messageBodyTextView resizes just fine with all this code (I have a feeling a have a bunch of redundant code in there). But self.messageBodyScrollView either doesn't resize at all or if I try to use setBounds then it not only resizes messageBodyTextView to messageBodyScrollView's full size but it also stretches out the text inside.
note: messageBodyTextView and messageBodyScrollView are both attached to my IB doc as IBOutlets.
My code used to be a lot shorter but this is where I've gotten to by adding in anything I can find to make these two views match up.
Any help would be very much appreciated!

best option for background subtraction using emgucv?

can you suggest a good option for background subtraction using emgucv? my project is real time pedestrian detection.
Not sure if you still need this, but...in EmguCV, if you have 2 images of say type Image<Bgr, Byte> or any other type, called img1 and img2, doing img1 - img2 does work! There is a function called AbsDiff as well, I think it works like this: img1.AbsDiff(img2), you could look into that.
If you already have the picture of the background (img1) and you have the current frame (img2), you could do the above.
This is quite possible take a look at the "MotionDetection" example provided with EMGU this should get you started.
Effectively the code that removes the foreground is effectively named "_forgroundDetector" it is the "_motionHistory" that presents stores what movement has occurred.
The example has everything you need if you have trouble running it let me know,
Cheer
Chris
See:Removing background from _capture.QueryFrame()

Resources