|
Panda3D
|
A base class for any number of different kinds of lenses, linear and otherwise. More...
Public Types | |
| enum | FromCorners { FC_roll = 1, FC_camera_plane = 2, FC_off_axis = 4, FC_aspect_ratio = 8, FC_shear = 16, FC_keystone = 32 } |
| enum | StereoChannel { SC_mono = 0, SC_left = 1, SC_right = 2, SC_stereo = 3 } |
Public Member Functions | |
| clear () | |
| Resets all lens parameters to their initial default settings. More... | |
| clearCustomFilmMat () | |
| Disables the lens custom_film_mat correction. More... | |
| clearKeystone () | |
| Disables the lens keystone correction. More... | |
| clearViewMat () | |
| Resets the lens transform to identity. More... | |
| bool | extrude (const LPoint2 point2d, LPoint3 near_point, LPoint3 far_point) |
| Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner, compute the corresponding vector in space that maps to this point, if such a vector can be determined. More... | |
| bool | extrude (const LPoint3 point2d, LPoint3 near_point, LPoint3 far_point) |
| Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner, compute the corresponding vector in space that maps to this point, if such a vector can be determined. More... | |
| bool | extrudeDepth (const LPoint3 point2d, LPoint3 point3d) |
| Uses the depth component of the 3-d result from project() to compute the original point in 3-d space corresponding to a particular point on the lens. More... | |
| bool | extrudeVec (const LPoint2 point2d, LVector3 vec3d) |
| Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner, compute the vector that corresponds to the view direction. More... | |
| bool | extrudeVec (const LPoint3 point2d, LVector3 vec3d) |
| Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner, compute the vector that corresponds to the view direction. More... | |
| float | getAspectRatio () |
| Returns the aspect ratio of the Lens. More... | |
| str | getChangeEvent () |
| Returns the name of the event that will be generated whenever any properties of this particular Lens have changed. More... | |
| float | getConvergenceDistance () |
| See set_convergence_distance(). More... | |
| CoordinateSystem | getCoordinateSystem () |
| Returns the coordinate system that all 3-d computations are performed within for this Lens. More... | |
| const LMatrix4 | getCustomFilmMat () |
| Returns the custom_film_mat specified for the lens. More... | |
| float | getFar () |
| Returns the position of the far plane (or cylinder, sphere, whatever). More... | |
| const LMatrix4 | getFilmMat () |
| Returns the matrix that transforms from a point behind the lens to a point on the film. More... | |
| const LMatrix4 | getFilmMatInv () |
| Returns the matrix that transforms from a point on the film to a point behind the lens. More... | |
| const LVector2 | getFilmOffset () |
| Returns the horizontal and vertical offset amounts of this Lens. More... | |
| const LVecBase2 | getFilmSize () |
| Returns the horizontal and vertical film size of the virtual film. More... | |
| float | getFocalLength () |
| Returns the focal length of the lens. More... | |
| const LVecBase2 | getFov () |
| Returns the horizontal and vertical film size of the virtual film. More... | |
| float | getHfov () |
| Returns the horizontal component of fov only. More... | |
| float | getInterocularDistance () |
| See set_interocular_distance(). More... | |
| const LVecBase2 | getKeystone () |
| Returns the keystone correction specified for the lens. More... | |
| UpdateSeq | getLastChange () |
| Returns the UpdateSeq that is incremented whenever the lens properties are changed. More... | |
| const LMatrix4 | getLensMat () |
| Returns the matrix that transforms from a point in front of the lens to a point in space. More... | |
| const LMatrix4 | getLensMatInv () |
| Returns the matrix that transforms from a point in space to a point in front of the lens. More... | |
| float | getMinFov () |
| Returns the field of view of the narrowest dimension of the window. More... | |
| float | getNear () |
| Returns the position of the near plane (or cylinder, sphere, whatever). More... | |
| LPoint3 | getNodalPoint () |
| Returns the center point of the lens: the point from which the lens is viewing. More... | |
| const LMatrix4 | getProjectionMat (Lens::StereoChannel channel) |
| Returns the complete transformation matrix from a 3-d point in space to a point on the film, if such a matrix exists, or the identity matrix if the lens is nonlinear. More... | |
| const LMatrix4 | getProjectionMatInv (Lens::StereoChannel channel) |
| Returns the matrix that transforms from a 2-d point on the film to a 3-d vector in space, if such a matrix exists. More... | |
| const LVector3 | getUpVector () |
| Returns the axis perpendicular to the camera's view vector that indicates the "up" direction. More... | |
| float | getVfov () |
| Returns the vertical component of fov only. More... | |
| const LVecBase3 | getViewHpr () |
| Returns the direction in which the lens is facing. More... | |
| const LMatrix4 | getViewMat () |
| Returns the direction in which the lens is facing. More... | |
| const LVector3 | getViewVector () |
| Returns the axis along which the lens is facing. More... | |
| bool | isLinear () |
| Returns true if the lens represents a linear projection (e.g. More... | |
| bool | isOrthographic () |
| Returns true if the lens represents a orthographic projection (i.e. More... | |
| bool | isPerspective () |
| Returns true if the lens represents a perspective projection (i.e. More... | |
| BoundingVolume | makeBounds () |
| Allocates and returns a new BoundingVolume that encloses the frustum used for this kind of lens, if possible. More... | |
| Lens | makeCopy () |
| Geom | makeGeometry () |
| Allocates and returns a new Geom that can be rendered to show a visible representation of the frustum used for this kind of lens, if it makes sense to do so. More... | |
| output (Ostream out) | |
| bool | project (const LPoint3 point3d, LPoint2 point2d) |
| Given a 3-d point in space, determine the 2-d point this maps to, in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner. More... | |
| bool | project (const LPoint3 point3d, LPoint3 point2d) |
| Given a 3-d point in space, determine the 2-d point this maps to, in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner. More... | |
| recomputeAll () | |
| Forces all internal parameters of the Lens to be recomputed. More... | |
| setAspectRatio (float aspect_ratio) | |
| Sets the aspect ratio of the lens. More... | |
| setChangeEvent (str event) | |
| Sets the name of the event that will be generated whenever any properties of the Lens have changed. More... | |
| setConvergenceDistance (float convergence_distance) | |
| Sets the distance between between the camera plane and the point in the distance that the left and right eyes are both looking at. More... | |
| setCoordinateSystem (CoordinateSystem cs) | |
| Specifies the coordinate system that all 3-d computations are performed within for this Lens. More... | |
| setCustomFilmMat (const LMatrix4 custom_film_mat) | |
| Specifies a custom matrix to transform the points on the film after they have been converted into nominal film space (-1 . More... | |
| setFar (float far_distance) | |
| Defines the position of the far plane (or cylinder, sphere, whatever). More... | |
| setFilmOffset (const LVecBase2 film_offset) | |
| Sets the horizontal and vertical offset amounts of this Lens. More... | |
| setFilmOffset (float x, float y) | |
| Sets the horizontal and vertical offset amounts of this Lens. More... | |
| setFilmSize (const LVecBase2 film_size) | |
| Sets the size and shape of the "film" within the lens. More... | |
| setFilmSize (float width) | |
| Sets the horizontal size of the film without changing its shape. More... | |
| setFilmSize (float width, float height) | |
| Sets the size and shape of the "film" within the lens. More... | |
| setFocalLength (float focal_length) | |
| Sets the focal length of the lens. More... | |
| setFov (const LVecBase2 fov) | |
| Sets the field of view of the lens in both dimensions. More... | |
| setFov (float fov) | |
| Sets the horizontal field of view of the lens without changing the aspect ratio. More... | |
| setFov (float hfov, float vfov) | |
| Sets the field of view of the lens in both dimensions. More... | |
| setFrustumFromCorners (const LVecBase3 ul, const LVecBase3 ur, const LVecBase3 ll, const LVecBase3 lr, int flags) | |
| Sets up the lens to use the frustum defined by the four indicated points. More... | |
| setInterocularDistance (float interocular_distance) | |
| Sets the distance between the left and right eyes of a stereo camera. More... | |
| setKeystone (const LVecBase2 keystone) | |
| Indicates the ratio of keystone correction to perform on the lens, in each of three axes. More... | |
| setMinFov (float min_fov) | |
| Sets the field of view of the smallest dimension of the window. More... | |
| setNear (float near_distance) | |
| Defines the position of the near plane (or cylinder, sphere, whatever). More... | |
| setNearFar (float near_distance, float far_distance) | |
| Simultaneously changes the near and far planes. More... | |
| setViewHpr (const LVecBase3 view_hpr) | |
| Sets the direction in which the lens is facing. More... | |
| setViewHpr (float h, float p, float r) | |
| Sets the direction in which the lens is facing. More... | |
| setViewMat (const LMatrix4 view_mat) | |
| Sets an arbitrary transformation on the lens. More... | |
| setViewVector (const LVector3 view_vector, const LVector3 up_vector) | |
| Specifies the direction in which the lens is facing by giving an axis to look along, and a perpendicular (or at least non-parallel) up axis. More... | |
| setViewVector (float x, float y, float z, float i, float j, float k) | |
| Specifies the direction in which the lens is facing by giving an axis to look along, and a perpendicular (or at least non-parallel) up axis. More... | |
| write (Ostream out, int indent_level) | |
| Public Member Functions inherited from TypedWritable | |
| object | __reduce__ () |
| object | __reduce_persist__ (object pickler) |
| VectorUchar | encodeToBamStream () |
| Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More... | |
| bool | encodeToBamStream (VectorUchar data, BamWriter writer) |
| Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More... | |
| fillin (DatagramIterator scan, BamReader manager) | |
| This internal function is intended to be called by each class's make_from_bam() method to read in all of the relevant data from the BamFile for the new object. More... | |
| UpdateSeq | getBamModified () |
| Returns the current bam_modified counter. More... | |
| markBamModified () | |
| Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More... | |
| Public Member Functions inherited from TypedObject | |
| TypeHandle | getType () |
| int | getTypeIndex () |
| Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
| bool | isExactType (TypeHandle handle) |
| Returns true if the current object is the indicated type exactly. More... | |
| bool | isOfType (TypeHandle handle) |
| Returns true if the current object is or derives from the indicated type. More... | |
| Public Member Functions inherited from ReferenceCount | |
| int | getRefCount () |
| Returns the current reference count. More... | |
| ref () | |
| Explicitly increments the reference count. More... | |
| bool | testRefCountIntegrity () |
| Does some easy checks to make sure that the reference count isn't completely bogus. More... | |
| bool | testRefCountNonzero () |
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More... | |
| bool | unref () |
| Explicitly decrements the reference count. More... | |
Static Public Member Functions | |
| static TypeHandle | getClassType () |
| static float | getDefaultFar () |
| Returns the default far plane distance that will be assigned to each newly- created lens. More... | |
| static float | getDefaultNear () |
| Returns the default near plane distance that will be assigned to each newly-created lens. More... | |
| Static Public Member Functions inherited from TypedWritableReferenceCount | |
| static TypedWritableReferenceCount | decodeFromBamStream (VectorUchar data, BamReader reader) |
| Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on those bytes. More... | |
| static TypeHandle | getClassType () |
| Static Public Member Functions inherited from TypedWritable | |
| static TypeHandle | getClassType () |
| Static Public Member Functions inherited from TypedObject | |
| static TypeHandle | getClassType () |
| Static Public Member Functions inherited from ReferenceCount | |
| static TypeHandle | getClassType () |
Public Attributes | |
| float | aspect_ratio |
| Returns the aspect ratio of the Lens. More... | |
| const String | change_event |
| Returns the name of the event that will be generated whenever any properties of this particular Lens have changed. More... | |
| float | convergence_distance |
| See set_convergence_distance(). More... | |
| CoordinateSystem | coordinate_system |
| Returns the coordinate system that all 3-d computations are performed within for this Lens. More... | |
| float | far |
| Returns the position of the far plane (or cylinder, sphere, whatever). More... | |
| const LVector2 | film_offset |
| Returns the horizontal and vertical offset amounts of this Lens. More... | |
| const LVecBase2 | film_size |
| Returns the horizontal and vertical film size of the virtual film. More... | |
| float | focal_length |
| Returns the focal length of the lens. More... | |
| const LVecBase2 | fov |
| Returns the horizontal and vertical film size of the virtual film. More... | |
| float | interocular_distance |
| See set_interocular_distance(). More... | |
| const LVecBase2 | keystone |
| Returns the keystone correction specified for the lens. More... | |
| float | min_fov |
| Returns the field of view of the narrowest dimension of the window. More... | |
| float | near |
| Returns the position of the near plane (or cylinder, sphere, whatever). More... | |
| LPoint3 | nodal_point |
| Returns the center point of the lens: the point from which the lens is viewing. More... | |
| const LVecBase3 | view_hpr |
| Returns the direction in which the lens is facing. More... | |
| const LMatrix4 | view_mat |
| Returns the direction in which the lens is facing. More... | |
| Public Attributes inherited from TypedObject | |
| TypeHandle | type |
| Returns the TypeHandle representing this object's type. More... | |
| Public Attributes inherited from ReferenceCount | |
| int | ref_count |
| The current reference count. More... | |
A base class for any number of different kinds of lenses, linear and otherwise.
Presently, this includes perspective and orthographic lenses.
A Lens object is the main part of a Camera node, which defines the fundamental interface to point-of-view for rendering. Lenses are also used in other contexts, however; for instance, a Spotlight is also defined using a lens.
| enum FromCorners |
| enum StereoChannel |
| clear | ( | ) |
Resets all lens parameters to their initial default settings.
| clearCustomFilmMat | ( | ) |
Disables the lens custom_film_mat correction.
| clearKeystone | ( | ) |
Disables the lens keystone correction.
| clearViewMat | ( | ) |
Resets the lens transform to identity.
Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner, compute the corresponding vector in space that maps to this point, if such a vector can be determined.
The vector is returned by indicating the points on the near plane and far plane that both map to the indicated 2-d point.
Returns true if the vector is defined, or false otherwise.
Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner, compute the corresponding vector in space that maps to this point, if such a vector can be determined.
The vector is returned by indicating the points on the near plane and far plane that both map to the indicated 2-d point.
The z coordinate of the 2-d point is ignored.
Returns true if the vector is defined, or false otherwise.
Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner, compute the vector that corresponds to the view direction.
This will be parallel to the normal on the surface (the far plane) corresponding to the lens shape at this point.
See the comment block on Lens::extrude_vec_impl() for a more in-depth comment on the meaning of this vector.
Returns true if the vector is defined, or false otherwise.
Given a 2-d point in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner, compute the vector that corresponds to the view direction.
This will be parallel to the normal on the surface (the far plane) corresponding to the lens shape at this point.
See the comment block on Lens::extrude_vec_impl() for a more in-depth comment on the meaning of this vector.
The z coordinate of the 2-d point is ignored.
Returns true if the vector is defined, or false otherwise.
| float getAspectRatio | ( | ) |
Returns the aspect ratio of the Lens.
This is determined based on the indicated film size; see set_film_size().
| str getChangeEvent | ( | ) |
Returns the name of the event that will be generated whenever any properties of this particular Lens have changed.
|
static |
| float getConvergenceDistance | ( | ) |
See set_convergence_distance().
| CoordinateSystem getCoordinateSystem | ( | ) |
Returns the coordinate system that all 3-d computations are performed within for this Lens.
Normally, this is CS_default.
| const LMatrix4 getCustomFilmMat | ( | ) |
Returns the custom_film_mat specified for the lens.
|
static |
Returns the default far plane distance that will be assigned to each newly- created lens.
This is read from the Config.prc file.
|
static |
Returns the default near plane distance that will be assigned to each newly-created lens.
This is read from the Config.prc file.
| float getFar | ( | ) |
Returns the position of the far plane (or cylinder, sphere, whatever).
| const LMatrix4 getFilmMat | ( | ) |
Returns the matrix that transforms from a point behind the lens to a point on the film.
| const LMatrix4 getFilmMatInv | ( | ) |
Returns the matrix that transforms from a point on the film to a point behind the lens.
| const LVector2 getFilmOffset | ( | ) |
Returns the horizontal and vertical offset amounts of this Lens.
See set_film_offset().
| const LVecBase2 getFilmSize | ( | ) |
Returns the horizontal and vertical film size of the virtual film.
See set_film_size().
| float getFocalLength | ( | ) |
Returns the focal length of the lens.
This may have been set explicitly by a previous call to set_focal_length(), or it may be computed based on the lens' fov and film_size. For certain kinds of lenses, the focal length has no meaning.
| const LVecBase2 getFov | ( | ) |
Returns the horizontal and vertical film size of the virtual film.
See set_fov().
| float getHfov | ( | ) |
Returns the horizontal component of fov only.
See get_fov().
| float getInterocularDistance | ( | ) |
See set_interocular_distance().
| const LVecBase2 getKeystone | ( | ) |
Returns the keystone correction specified for the lens.
| UpdateSeq getLastChange | ( | ) |
Returns the UpdateSeq that is incremented whenever the lens properties are changed.
As long as this number remains the same, you may assume the lens properties are unchanged.
| const LMatrix4 getLensMat | ( | ) |
Returns the matrix that transforms from a point in front of the lens to a point in space.
| const LMatrix4 getLensMatInv | ( | ) |
Returns the matrix that transforms from a point in space to a point in front of the lens.
| float getMinFov | ( | ) |
Returns the field of view of the narrowest dimension of the window.
See set_min_fov().
| float getNear | ( | ) |
Returns the position of the near plane (or cylinder, sphere, whatever).
| LPoint3 getNodalPoint | ( | ) |
Returns the center point of the lens: the point from which the lens is viewing.
| const LMatrix4 getProjectionMat | ( | Lens::StereoChannel | channel | ) |
Returns the complete transformation matrix from a 3-d point in space to a point on the film, if such a matrix exists, or the identity matrix if the lens is nonlinear.
| const LMatrix4 getProjectionMatInv | ( | Lens::StereoChannel | channel | ) |
Returns the matrix that transforms from a 2-d point on the film to a 3-d vector in space, if such a matrix exists.
| const LVector3 getUpVector | ( | ) |
Returns the axis perpendicular to the camera's view vector that indicates the "up" direction.
| float getVfov | ( | ) |
Returns the vertical component of fov only.
See get_fov().
| const LVecBase3 getViewHpr | ( | ) |
Returns the direction in which the lens is facing.
| const LMatrix4 getViewMat | ( | ) |
Returns the direction in which the lens is facing.
| const LVector3 getViewVector | ( | ) |
Returns the axis along which the lens is facing.
| bool isLinear | ( | ) |
Returns true if the lens represents a linear projection (e.g.
PerspectiveLens, OrthographicLens), and therefore there is a valid matrix returned by get_projection_mat(), or false otherwise.
| bool isOrthographic | ( | ) |
Returns true if the lens represents a orthographic projection (i.e.
it is a OrthographicLens), false otherwise.
| bool isPerspective | ( | ) |
Returns true if the lens represents a perspective projection (i.e.
it is a PerspectiveLens), false otherwise.
| BoundingVolume makeBounds | ( | ) |
Allocates and returns a new BoundingVolume that encloses the frustum used for this kind of lens, if possible.
If a suitable bounding volume cannot be created, returns NULL.
| Lens makeCopy | ( | ) |
| Geom makeGeometry | ( | ) |
Allocates and returns a new Geom that can be rendered to show a visible representation of the frustum used for this kind of lens, if it makes sense to do so.
If a visible representation cannot be created, returns NULL.
| output | ( | Ostream | out | ) |
Given a 3-d point in space, determine the 2-d point this maps to, in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner.
Returns true if the 3-d point is in front of the lens and within the viewing frustum (in which case point2d is filled in), or false otherwise (in which case point2d will be filled in with something, which may or may not be meaningful).
Given a 3-d point in space, determine the 2-d point this maps to, in the range (-1,1) in both dimensions, where (0,0) is the center of the lens and (-1,-1) is the lower-left corner.
The z coordinate will also be set to a value in the range (-1, 1), where 1 represents a point on the near plane, and -1 represents a point on the far plane.
Returns true if the 3-d point is in front of the lens and within the viewing frustum (in which case point2d is filled in), or false otherwise (in which case point2d will be filled in with something, which may or may not be meaningful).
| recomputeAll | ( | ) |
Forces all internal parameters of the Lens to be recomputed.
Normally, this should never need to be called; it is provided only to assist in debugging.
| setAspectRatio | ( | float | aspect_ratio | ) |
Sets the aspect ratio of the lens.
This is the ratio of the height to the width of the generated image. Setting this overrides the two-parameter fov or film size setting.
| setChangeEvent | ( | str | event | ) |
Sets the name of the event that will be generated whenever any properties of the Lens have changed.
If this is not set for a particular lens, no event will be generated.
The event is thrown with one parameter, the lens itself. This can be used to automatically track changes to camera fov, etc. in the application.
| setConvergenceDistance | ( | float | convergence_distance | ) |
Sets the distance between between the camera plane and the point in the distance that the left and right eyes are both looking at.
This distance is used to apply a stereo effect when the lens is rendered on a stereo display region. It only has an effect on a PerspectiveLens.
This parameter must be greater than 0, but may be as large as you like. It controls the distance at which the two stereo images will appear to converge, which is a normal property of stereo vision. Normally this should be set to the distance from the camera to the area of interest in your scene. Anything beyond this distance will appear to go into the screen, and anything closer will appear to come out of the screen. If you want to simulate parallel stereo, set this to infinity.
Note that this creates an off-axis frustum, which means that the lenses are still pointing in the same direction, which is usually more desirable than the more naive toe-in approach, where the two lenses are simply tilted toward each other.
Prior to Panda3D 1.9.0, the convergence was being calculated incorrectly. It has since been corrected. To restore the legacy behavior you can set the stereo-lens-old-convergence variable to true.
Also see set_interocular_distance(), which relates.
| setCoordinateSystem | ( | CoordinateSystem | cs | ) |
Specifies the coordinate system that all 3-d computations are performed within for this Lens.
Normally, this is CS_default.
| setCustomFilmMat | ( | const LMatrix4 | custom_film_mat | ) |
Specifies a custom matrix to transform the points on the film after they have been converted into nominal film space (-1 .
. 1 in U and V). This can be used to introduce arbitrary scales, rotations, or other linear transforms to the media plane. This is normally a 2-d matrix, but a full 4x4 matrix may be specified. This is applied on top of any film size, lens shift, and/or keystone correction.
| setFar | ( | float | far_distance | ) |
Defines the position of the far plane (or cylinder, sphere, whatever).
Points farther from the lens than this may not be rendered.
| setFilmOffset | ( | const LVecBase2 | film_offset | ) |
Sets the horizontal and vertical offset amounts of this Lens.
These are both in the same units specified in set_film_size().
This can be used to establish an off-axis lens.
| setFilmOffset | ( | float | x, |
| float | y | ||
| ) |
Sets the horizontal and vertical offset amounts of this Lens.
These are both in the same units specified in set_film_size().
This can be used to establish an off-axis lens.
| setFilmSize | ( | const LVecBase2 | film_size | ) |
Sets the size and shape of the "film" within the lens.
This both establishes the units used by calls like set_focal_length(), and establishes the aspect ratio of the frame.
In a physical camera, the field of view of a lens is determined by the lens' focal length and by the size of the film area exposed by the lens. For instance, a 35mm camera exposes a rectangle on the film about 24mm x 36mm, which means a 50mm lens gives about a 40-degree horizontal field of view.
In the virtual camera, you may set the film size to any units here, and specify a focal length in the same units to simulate the same effect. Or, you may ignore this parameter, and specify the field of view and aspect ratio of the lens directly.
| setFilmSize | ( | float | width | ) |
Sets the horizontal size of the film without changing its shape.
The aspect ratio remains unchanged; this computes the vertical size of the film to automatically maintain the aspect ratio.
| setFilmSize | ( | float | width, |
| float | height | ||
| ) |
Sets the size and shape of the "film" within the lens.
This both establishes the units used by calls like set_focal_length(), and establishes the aspect ratio of the frame.
In a physical camera, the field of view of a lens is determined by the lens' focal length and by the size of the film area exposed by the lens. For instance, a 35mm camera exposes a rectangle on the film about 24mm x 36mm, which means a 50mm lens gives about a 40-degree horizontal field of view.
In the virtual camera, you may set the film size to any units here, and specify a focal length in the same units to simulate the same effect. Or, you may ignore this parameter, and specify the field of view and aspect ratio of the lens directly.
| setFocalLength | ( | float | focal_length | ) |
Sets the focal length of the lens.
This may adjust the field-of-view correspondingly, and is an alternate way to specify field of view.
For certain kinds of lenses (e.g. OrthographicLens), the focal length has no meaning.
| setFov | ( | const LVecBase2 | fov | ) |
Sets the field of view of the lens in both dimensions.
This establishes both the field of view and the aspect ratio of the lens. This is one way to specify the field of view of a lens; set_focal_length() is another way.
For certain kinds of lenses (like OrthographicLens), the field of view has no meaning.
| setFov | ( | float | fov | ) |
Sets the horizontal field of view of the lens without changing the aspect ratio.
The vertical field of view is adjusted to maintain the same aspect ratio.
| setFov | ( | float | hfov, |
| float | vfov | ||
| ) |
Sets the field of view of the lens in both dimensions.
This establishes both the field of view and the aspect ratio of the lens. This is one way to specify the field of view of a lens; set_focal_length() is another way.
For certain kinds of lenses (like OrthoLens), the field of view has no meaning.
| setFrustumFromCorners | ( | const LVecBase3 | ul, |
| const LVecBase3 | ur, | ||
| const LVecBase3 | ll, | ||
| const LVecBase3 | lr, | ||
| int | flags | ||
| ) |
Sets up the lens to use the frustum defined by the four indicated points.
This is most useful for a PerspectiveLens, but it may be called for other kinds of lenses as well.
The frustum will be rooted at the origin (or by whatever translation might have been specified in a previous call to set_view_mat).
It is legal for the four points not to be arranged in a rectangle; if this is the case, the frustum will be fitted as tightly as possible to cover all four points.
The flags parameter contains the union of one or more of the following bits to control the behavior of this function:
FC_roll - If this is included, the camera may be rotated so that its up vector is perpendicular to the top line. Otherwise, the standard up vector is used.
FC_camera_plane - This allows the camera plane to be adjusted to be as nearly perpendicular to the center of the frustum as possible. Without this bit, the orientation camera plane is defined by position of the four points (which should all be coplanar). With this bit, the camera plane is arbitarary, and may be chosen so that the four points do not themselves lie in the camera plane (but the points will still be within the frustum).
FC_off_axis - This allows the resulting frustum to be off-axis to get the tightest possible fit. Without this bit, the viewing axis will be centered within the frustum, but there may be more wasted space along the edges.
FC_aspect_ratio - This allows the frustum to be scaled non-proportionately in the vertical and horizontal dimensions, if necessary, to get a tighter fit. Without this bit, the current aspect ratio will be preserved.
FC_shear - This allows the frustum to be sheared, if necessary, to get the tightest possible fit. This may result in a parallelogram-based frustum, which will give a slanted appearance to the rendered image. Without this bit, the frustum will be rectangle-based.
In general, if 0 is passed in as the value for flags, the generated frustum will be a loose fit but sane; if -1 is passed in, it will be a tighter fit and possibly screwy.
| setInterocularDistance | ( | float | interocular_distance | ) |
Sets the distance between the left and right eyes of a stereo camera.
This distance is used to apply a stereo effect when the lens is rendered on a stereo display region. It only has an effect on a PerspectiveLens.
The left eye and the right eye are each offset along the X axis by half of this distance, so that this parameter specifies the total distance between them.
Also see set_convergence_distance(), which relates.
| setKeystone | ( | const LVecBase2 | keystone | ) |
Indicates the ratio of keystone correction to perform on the lens, in each of three axes.
This will build a special non-affine scale factor into the projection matrix that will compensate for keystoning of a projected image; this can be used to compensate for a projector that for physical reasons cannot be aimed directly at its screen.
The default value is taken from the default-keystone Config variable. 0, 0 indicates no keystone correction; specify a small value (usually in the range -1 .. 1) in either the x or y position to generate a keystone correction in that axis.
| setMinFov | ( | float | min_fov | ) |
Sets the field of view of the smallest dimension of the window.
If the window is wider than it is tall, this specifies the vertical field of view; if it is taller than it is wide, this specifies the horizontal field of view.
In many cases, this is preferable to setting either the horizontal or vertical field of view explicitly. Setting this parameter means that pulling the window wider will widen the field of view, which is usually what you expect to happen.
| setNear | ( | float | near_distance | ) |
Defines the position of the near plane (or cylinder, sphere, whatever).
Points closer to the lens than this may not be rendered.
| setNearFar | ( | float | near_distance, |
| float | far_distance | ||
| ) |
Simultaneously changes the near and far planes.
| setViewHpr | ( | const LVecBase3 | view_hpr | ) |
Sets the direction in which the lens is facing.
Normally, this is down the forward axis (usually the Y axis), but it may be rotated. This is only one way of specifying the rotation; you may also specify an explicit vector in which to look, or you may give a complete transformation matrix.
| setViewHpr | ( | float | h, |
| float | p, | ||
| float | r | ||
| ) |
Sets the direction in which the lens is facing.
Normally, this is down the forward axis (usually the Y axis), but it may be rotated. This is only one way of specifying the rotation; you may also specify an explicit vector in which to look, or you may give a complete transformation matrix.
| setViewMat | ( | const LMatrix4 | view_mat | ) |
Sets an arbitrary transformation on the lens.
This replaces the individual transformation components like set_view_hpr().
Setting a transformation here will have a slightly different effect than putting one on the LensNode that contains this lens. In particular, lighting and other effects computations will still be performed on the lens in its untransformed (facing forward) position, but the actual projection matrix will be transformed by this matrix.
Specifies the direction in which the lens is facing by giving an axis to look along, and a perpendicular (or at least non-parallel) up axis.
See also set_view_hpr().
| setViewVector | ( | float | x, |
| float | y, | ||
| float | z, | ||
| float | i, | ||
| float | j, | ||
| float | k | ||
| ) |
Specifies the direction in which the lens is facing by giving an axis to look along, and a perpendicular (or at least non-parallel) up axis.
See also set_view_hpr().
| write | ( | Ostream | out, |
| int | indent_level | ||
| ) |
| float aspect_ratio |
Returns the aspect ratio of the Lens.
This is determined based on the indicated film size; see set_film_size().
| const String change_event |
Returns the name of the event that will be generated whenever any properties of this particular Lens have changed.
| float convergence_distance |
See set_convergence_distance().
| CoordinateSystem coordinate_system |
Returns the coordinate system that all 3-d computations are performed within for this Lens.
Normally, this is CS_default.
| float far |
Returns the position of the far plane (or cylinder, sphere, whatever).
| const LVector2 film_offset |
Returns the horizontal and vertical offset amounts of this Lens.
See set_film_offset().
| const LVecBase2 film_size |
Returns the horizontal and vertical film size of the virtual film.
See set_film_size().
| float focal_length |
Returns the focal length of the lens.
This may have been set explicitly by a previous call to set_focal_length(), or it may be computed based on the lens' fov and film_size. For certain kinds of lenses, the focal length has no meaning.
| const LVecBase2 fov |
Returns the horizontal and vertical film size of the virtual film.
See set_fov().
| float interocular_distance |
See set_interocular_distance().
| const LVecBase2 keystone |
Returns the keystone correction specified for the lens.
| float min_fov |
Returns the field of view of the narrowest dimension of the window.
See set_min_fov().
| float near |
Returns the position of the near plane (or cylinder, sphere, whatever).
| LPoint3 nodal_point |
Returns the center point of the lens: the point from which the lens is viewing.
| const LVecBase3 view_hpr |
Returns the direction in which the lens is facing.
| const LMatrix4 view_mat |
Returns the direction in which the lens is facing.


Person believed to have been stabbed in London Bridge area, suspect shot: source
LONDON (Reuters) - It is believed somebody was stabbed in the London Bridge area of central London on Friday and police have shot a suspect, a security source told Reuters on Friday.
Police earlier said they were dealing with an incident at London Bridge.


17
domestic | general | continuing requirements | 2009
regulation
mandatory
(1)
every air-conditioning system within a
building
is
inspected at regular intervals; and
(b)
appropriate advice is given to the users of the
buildings
on reducing the energy consumption of
such an air-conditioning system.
(2)
This regulation shall not apply to:
(a)
air-conditioning systems with a total effective output
rating of less than 12 kW; or
(b)
air-conditioning systems solely for processes within
a
building
.
(3)
In terms of section 2 of the Building (Scotland) Act 2003 the
provisions of paragraph (1) are a designated provision in
respect of which there is a continuing requirement imposed
on the owners of
buildings
.
0.17.1 Explanation
Regulation 17 requires the owners of an air-conditioned
building
to have such
plant regularly inspected and to provide advice to the users of the
building
on
related energy efficiency improvement
work
and how to operate the system
efficiently. This regulation implements the terms of Article 9 of Directive
2002/91/EC on the energy performance of
buildings
(EPBD).
Scope
The regulation relates only to larger, fixed air-conditioning systems and
does not cover portable systems. It also relates to comfort cooling of people
in a
building
but does not cover any other system, such as cooling solely
used in a manufacturing, trade or mechanical process. For example, a
system only cooling computer equipment would be exempt.
The efficiency of the system should be assessed and the sizing compared to
the cooling requirements of the
building
and appropriate advice given to the
users of the
building
on possible improvement or replacement of the system
and on alternative solutions.
Continuing requirement
The regulation imposes a continuing requirement that means inspections are
required not only throughout the life of a new
building
, but also for the life of
an existing
building
, for as long as it has an air-conditioning system. In the
early stages of implementation, a relaxation direction was used to
manage introduction of inspections. This relaxation expired on 4 January
2009 and phased introduction of inspections is outlined in this guidance.
CIBSE
CIBSE Technical Memorandum 44 (TM44) 'Inspection of air conditioning
systems' provides guidance on the regular inspection and assessment of
air-conditioning systems and on the provision of advice and alternative
solutions. TM44 can be used in Scotland subject to the paragraphs that
follow:
Inspection frequency
For completely new air-conditioning systems, one way of meeting paragraph
1(a) of this regulation would be to make arrangements at completion for the
0.17.1
—
0.17.3
domestic | general | continuing requirements | 2009
first inspection. This should be carried out by an accredited expert no later
than 5 years after the acceptance of the completion of commissioning of the
system to standard 6.7.
For existing systems over 250 kW, one way of meeting paragraph 1(a) of this
regulation would be to make arrangements for an inspection to be carried out
by an accredited expert. Thereafter the owner should ensure that the
inspection is carried out before 4 January 2011.
For existing systems of 250 kW or less, one way of meeting paragraph 1(a)
of this regulation would be to make arrangements for an inspection to be
carried out by an accredited expert. Thereafter the owner should ensure that
the inspection is carried out between 4 January 2011 and 4 January 2013.
In all cases, the accredited expert doing the inspection has the discretion to
set the frequency of inspections ranging from three years for poorly
maintained and inefficient systems up to five years for those systems that are
well maintained and demonstrate excellent levels of efficiency. In order to
ensure compliance with the continuing requirement, the subsequent
inspection should be carried out within the intervening time period.
The following issues should be considered in setting an inspection of
systems more frequently than five years:
a. inefficiency of system
b. significantly oversized in relation to the cooling requirements
c. evidence that the design is not fit for purpose
d. evidence of poor installation
e. evidence of lack of maintenance
f. control system out of adjustment
g. age of system.
Size of systems
A number of individual systems each 12 kW or less, but taken together
totalling more than 12 kW, within one
building
or fire-separated part of a
building,
would only qualify for inspection if they are linked by way of a central
control.
New buildings
air-conditioning systems and the provision of written information shall be in
accordance with standards 6.7 and 6.8 respectively and guidance to these
standards is provided in the Domestic and Non-domestic Technical
Handbooks.
Accredited experts
Inspections of existing air-conditioning systems should be carried out by
accredited experts who are members of protocol organisations who are
approved by Scottish Government to carry out such inspections.
0.17.4 Other legislative requirements
This guidance relates purely to Article 9 of the EPBD. There are other
separate legislative requirements for the inspection of air conditioning
systems such as the F-Gas Regulations which are not dealt within
building
regulations. However from an operational point of view, consideration could
be given to combining inspections where appropriate.
0.17.3
—
0.17.4


Active ingredient (in each tablet)
Doxylamine succinate 25 mg
Purpose
Nighttime sleep-aid
Use
- •
- helps to reduce difficulty in falling asleep
Warnings
Do not use
in children under 12 years of age
Ask a doctor before use if you have
- •
- a breathing problem such as asthma, emphysema or chronic bronchitis
- •
- glaucoma
- •
- trouble urinating due to an enlarged prostate gland
Ask a doctor or pharmacist before use if you are
taking any other drugs
When using this product
- •
- avoid alcoholic beverages
- •
- take only at bedtime
Stop use and ask a doctor if
- •
- sleeplessness persists continuously for more than two weeks. Insomnia may be a symptom of serious underlying medical illness.
If pregnant or breast-feeding,
ask a health professional before use.
Keep out of reach of children.
In case of overdose, get medical help or contact a Poison Control Center right away. (1-800-222-1222)
Directions
- •
- adults and children 12 years of age and over: take one tablet 30 minutes before going to bed; take once daily or as directed by a doctor
- •
- children under 12 years of age: do not use
Other information
- •
- store at 68°-77°F (20°-25°C)
- •
- retain in carton until time of use
- •
- see carton end panel for lot number and expiration date
Inactive ingredients
anhydrous dibasic calcium phosphate, dibasic calcium phosphate dihydrate, FD&C blue no. 1 aluminum lake, magnesium stearate, microcrystalline cellulose, sodium starch glycolate
Questions or comments?
1-800-719-9260
Principal Display Panel
Compare to Unisom® SleepTabs® active ingredient
Sleep Aid Tablets
doxylamine succinate tablets, 25 mg
Nighttime Sleep-Aid
Clinically Tested, Proven Effective
One Tablet Per Dose
32 tablets
actual size


{% extends 'fab/base-form.html' %} {% load render_form from directory_components_tags %} {% load static from staticfiles %} {% block head_css %} {{ block.super }} {% endblock %} {% block form_contents %} {% include 'fab/breadcrumbs.html' with label='Publish your profile' %}
Great.gov.uk has two services you can publish your profile on. ISD and great.gov.uk/trade/, you can publish to either or just one.
{% endif %} {{ block.super }} {% endblock %} {% block form %} {% if company.is_uk_isd_company %} {% with company.is_published_investment_support_directory as is_published %}This business profile is ready to be published on UK Investment Support Directory on great.gov.uk. We'll email you when it goes live.
{% include 'directory_components/form_widgets/form_field.html' with field=form.is_published_investment_support_directory %}This business profile is ready to be published on UK Find a Supplier on great.gov.uk/trade.
{% include 'directory_components/form_widgets/form_field.html' with field=form.is_published_find_a_supplier %}By publishing, you're confirming that you're responsible for the accuracy of the content you publish.
We'll send you a letter to this business to confirm publication.


Questions Page
Post a new question
QUESTIONS
Showing 3 of 5 questions
«
1
2
3
»
×
Add a Question
Home


Interfacing to Nocedal et al. L-BFGS-B.3.0 (2011) limited memory BFGS minimizer with bounds on parameters.
| Version: | 2015-2.13 |
| Depends: | R (≥ 2.15.0), numDeriv |
| Published: | 2015-02-18 |
| Author: | John C Nash [aut, cre], Ciyou Zhu [aut], Richard Byrd [aut], Jorge Nocedal [aut], Jose Luis Morales [aut] |
| Maintainer: | John C Nash <nashjc at uottawa.ca> |
| License: | GPL-2 |
| NeedsCompilation: | yes |
| Materials: | NEWS |
| In views: | Optimization |
| CRAN checks: | lbfgsb3 results |
| Reference manual: | lbfgsb3.pdf |
| Package source: | lbfgsb3_2015-2.13.tar.gz |
| Windows binaries: | r-devel: lbfgsb3_2015-2.13.zip, r-release: lbfgsb3_2015-2.13.zip, r-oldrel: lbfgsb3_2015-2.13.zip |
| OS X binaries: | r-release: lbfgsb3_2015-2.13.tgz, r-oldrel: lbfgsb3_2015-2.13.tgz |
| Reverse suggests: | blackbox, nlmixr, optimx |
Please use the canonical form https://CRAN.R-project.org/package=lbfgsb3 to link to this page.


})
sentence_index += 1
results["tokens"] = results["words"]
return return_dicts
for instance in sentence_instances]
if not flattened_instances:
return sanitize(return_dicts)
// Make the instances into batches and check the last batch for
// padded elements as the number of instances might not be perfectly
// divisible by the batch size.


|
Yeongtak Oh
I am a Ph.D. student of the DSAIL Lab at Seoul National University, Seoul, South Korea. I am working on computer vision and machine learning.
I received a BS in mechanical engineering from Seoul National University, Seoul, Korea, in 2018. I received an MS in the same department at SNU, in 2020. I worked as a Military Science and Technology Researcher in 2021 at the Korea Military Academy AI R&D Center. My current research topics are related to continual learning and vision-language models.
Email  /
CV  /
Google Scholar  /
Github
|


class: center, middle, inverse, title-slide # Geography 176A ## Lecture 22: The end… ### Mike Johnson ---  class: middle, inverse, center # Data Science --- # Day #1: Introduction - GEOG 176A is part of a 3-part series, you are just getting started! -- - Our goal was to learn the _underlying utilities_ and _concepts_ that drive **all** GIS platforms -- - We chose to use `R` because it offers a powerful data science component and spatial component built on the international standards (simple features and raster) -- - Programming is about finding a sequence of instructions to perform/automate a task (like your labs) -- - The learning curve for coding is difficult and things click at different times --- # Day #2: Geoinformatics - Information and Geographic _Systems_ -- - Information and Geographic _Science_ -- - Spatial Data Science - or - **Geoinformatics** -- _How do we combine the knowledge of computer science, mathmatics, information science, and data science to answer geographic questions?_ -- - Understand our computer and systems for working with digital data in a reproducible, flexible way. -- - Have a strong foundation in standard data manipulation and data visualization -- - Understand what makes "spatial" special including familiarity with vector objects, raster fields, and time. --- # Day #3: The Digital Environment - **Files** : comprised of a path, name and extension - Files are made of of bits and bytes -- - **Naming things:** - being intentional about how we name "things" (directories, files, and variables) - focusing on making names machine and human readable, as well as sortable (think lab 5!) -- - **Never, never, never, never have spaces in your paths or names!!!** -- - RStudio Projects as a way of enforcing a common working directory -- - All projects contain structure, and almost all projects (ArcMap, R, Java, Word) can use the same structure -- - Never, never, never, never use `setwd()`!!! --- # Our goal for good GI science ... *Well-annotated*: Through documentation and comments *Organized*: Project Structure *Raw Data*: Keep raw data raw! *Final Reports*: Rmarkdown files *Unbreakable Paths*: Rproj to the rescue *Complete History*: Version control with git and GitHub -- For this we learned Rmarkdown, GitHub, GitHub Pages, Rmd files, and R scripts --- # Day #4: Data Types and Structure - Data Types (logical, numeric, integer, **raw**) -- - Dates, factors, POSIXct are S3 classs built on these primitive types -- - Types can be stored as atomic (single-type) vectors -- - Vectors can have dimension! - 2D is a matrix - 3D is an array -- - Multiple vectors of varying size can be stored as a list -- - A `data.frame` is a list of equaled sized 1D vectors. -- - data.frames drive our vectors view of the world - diminsioned vectors drive our raster view of the world --- # Day #5: Data Frame Manipulation - Grammer of Data manipulation: `dplyr` -- - Based on SQL (Structured Query Language) -- - Pure verbs: `select` (columnwise reduction) and `filter` (row-wise reduction) -- - Manipulation verbs: `mutate` (add), `summarize` (reduce), `arrange` (sort) -- - The level of analysis can be controlled by `group_by` --- # Day #6: Data Visulaization - Grammar of Graphics: `ggplot` -- - ggplot graphics are built step by step by adding new elements and layers - Data - Geometry (geom) - Aesthetic mapping - Theme - Elements of a plot are layered by iteritavly adding elements -- - These can be added in a series of 5 steps: - Setup - Layers - Labels - Facets - Themes --- # Day #7: Relations and Format - Joining data -- - Data can be integrated/joined/merged by defining a relation (relational data) -- - Relations are defined by a shared key (*primary* and *foreign*) -- - The join operation you chose dictates which dataset "dominates" the join - left, right, inner, full, semi, and anti joins -- Data can be formatted in different ways: -- - "tidy" or "wide" way (each row is one observation) -- - Or "long" (each row is one data point) -- - `pivot_wider` and `pivot_longer` allow us to move between these forms -- - `sfc` columns cannot yet be pivoted! (`st_drop_geometry`) --- # Day #8: Time and Summary - Lags and rolling functions are useful for feature-based time data -- - Recreated graphics from the NY-Times related to COVID using table manipulation and ggplot --- class: middle, inverse, center # Spatial Objects --- # Day #9: Spatial Data Libraries - OSGeo and OGC are high-level governing bodies for geospatial libraries -- # GEOS - ports a subset of the JTS Topology Suite which conforms to the Simple Features specification for SQL -- - Provides an object model for planar geometry and geometric functions -- - Area and distance functions, spatial predicats (DE-9IM) overlay, buffer, simplifications, voronoi tesselation ... -- - Reading and writing of WKT and WKB (as well as GML) -- # PRØJ - transforms geospatial coordinates from one coordinate reference system (CRS) to another including cartographic projections and geodetic transformations. --- # GDAL - provides a software library for reading and writing raster and vector data formats -- - presents a single abstract data model to the calling application for all supported formats. --- # PostGIS - PostGIS (POST-jis) follows the Simple Features for SQL specification -- - adds support for geographic objects to the PostgreSQL object-relational database. # PostgreSQL - is relational database management system (R/DBMS) emphasizing extensibility and SQL compliance. --- # sf: Simple features in R Binds to these libraries represents simple features as records (rows) in a `data.frame` _with_ a geometry list-column ```r library(sf) sf::sf_extSoftVersion() ``` ``` GEOS GDAL proj.4 GDAL_with_GEOS USE_PROJ_H "3.8.1" "3.1.1" "6.3.1" "true" "true" ```  --- # Day #10: Simple Features Simple features refer to the formal standard (ISO 19125-1:2004) describing how objects in the real world can be represented in computers, with emphasis on the spatial geometry of these objects. Simple features require 2 components a geometry and a CRS --- # Day #10: Simple Features - 17 geometry types with the "big" 7 -- - All geometries are composed of `POINT` features -- - `POINT` features can have 2-4 dimensions (XYZM), but are 0 dimensional features! - `LINESTRING` features are an ordered set of POINTS (1D feature) - `POLYGON` features are a ordered, closed set of POINTS (2D feature) -- - Geometries can be encoded as WKT or WKB (human and machine readable forms) -- - Geometries can be cast to other forms but need to be leveled (`st_cast`, `st_union`, `st_combine`) --- # In R - each geometry is a `sfg` -- - a collection of `sfg` features is `sfc` (list-column) -- - an `sfc` can be added to a data.frame of attributes to create a `sf`  --- # Day #11: CRS How do we take a 3D earth and translate it into a 2D (planar) planar representation? -- - Geographic coordinate systems (GCS) identify a location on the Earth’s surface using longitude and latitude. - Longitude is the angular distance East or West of the Prime Meridian plane. - Latitude is angular distance North or South of the equatorial plane. -- - The _surface_ of the Earth in GCS is represented by _ellipsoidal_ surface. - Ellipsoidal models are defined by two parameters: the semi major and semi minor axis --- - Ellipsoids are part of a wider component of GCSs: the datum - Datums describe the irregularities in a earths surface (geoid) compared to a smooth ellipsoid surface  --- # Datum  --- - It is difficult to measure things like area, distance, or length on a `3D` model -- - think of the speed in calculating geodesic (ellipsoid based) distances in lab 2) -- - Therefore we need a `2D` planar surface to compute geometric properties -- - To create this we must **project** the GCS to a _Projected Coordinate System_ -- - Every PCS distorts the 3D surface is some way (`area`, `shape`, `distance`, `size`) -- - All PCS have a unit of measurement and a false origin unique to that projection -- - These are defined in the `proj4string`, and if common, and `EPSG` integer identifier --- # Day #12: Spatial Predicates - Geometries have `interiors`, `exteriors` and `boundaries` (3) -- - The relation between two geometries can be defined by the intersection of these three states (`3x3 = 9`) -- - Intersection can occur as `0D` (point), `1D` (line), or `2D` (area) -- - These 9 intersections define the DE-9IM matrix which can have the set domain of `{0,1,2,F}` or `{T,F}` -- - The DE-9IM string for an intersection is something like `T*F**FFF*` -- - Certain combinations of the DE-9IM matrix are so common that they are called spatial predicates - `equals`, `disjoin`, `touches`, `contains`, `covers`, `intersects`, etc -- - These spatial predicates are "masks" that test against DE-9IM strings to return `{T,F}` conditions --- # Day #13: Unary, Binary, Simplification - Spatial predicates can be used to *join* and *filter* spatially (boolean reducers) -- - Simplification is a way of reducing the vertex count in a geometry to speed up topology calculations -- - Looked at the **Douglas–Peucker** methods which works feature by feature -- - **Visvalingam** (`rmapshaper`): which is topology preserving -- - Looked at **Unary** (single) feature operations like `centroids`, `buffer`, and `bbox` -- - Looked at **Binary** (mutli) feature operations like `intersection` (clip), `union`, `combine` --- # Day #14: Writing Functions - Realized that `functions` are `R` objects (of type `closure`) -- - Began to look at reducing our repetitious work flows by writing functions -- - Created plotting and a Point-in-Polygon (PIP) function --- # Day #15: MAUP and Tessalations - We introduced the idea of object (discrete) and field (continuous) views of the world (Kuhn 2012) -- - Discussed ways to produce object based coverages using: - `tessellations` (`grid` and `hexagon`) - `triagulation` (Delaunay) - `Voroni` (Thiessen) polygons -- - The last two required "anchor" points -- - Each tessellation type has pros and cons depending on the use, size and application -- - We discussed some of these implications in the contexts of gerrymandering -- - The notion of a square/grid (`st_make_grid`) tessellation carries us into our raster discussion --- # Day #16: Interactive Web Mapping - Web tiles are served as 256 x 256 pixel png files indexed as {X}{Y}{Z}: Z equals Zoom  -- - Each zoom level (0-21) breaks the tiles from the previous zoom into 4 new pieces. -- - This tiling allows only the data that needed to be rendered -- - Is the basis for Google Earth Engine --- class: middle, center, inverse # Field Data --- # Day #17: Raster Data Model - Raster Data is 2-pronged: _values_ and _structure_ -- - **values** are diminsioned vectors - nothing more (`getValues()`) -- - **Structure** is intentionally light weight and without coordinates:  --- - *colors* are mapped over a _range_ and a _set number of breaks_, on screen you can have 256 colors - 8-bit color graphics are a method of storing image information in a computer's memory or in an image file, so that each pixel is represented by one 8-bit byte. - The maximum number of colors that can be displayed at any one time is 256 or 28 --- # Day #18: Raster Data Manipulation - Raster data can be cropped and masked -- - Masks are a version of a local operation where 1 = keep, NA = remove -- - Looked carefully at `reclassify`, `cellStats` (global), `calc` (local) -- - Focused on raster thesholding on conditions and statements -- - The raster class has specific implementations of _logical_, _algebraic_, and _common_ functions, for anything outside of these `calc` should be used -- # OSM - Open Street Map is a rich source for feature data about "anything" -- - Data is accessed through the Overpass Query (POSTs an http request) -- - Data is scoped by a bounding box, and a `key=value` pair -- - The OSM Wiki is a one stop shop to identify key=value pairs -- - OSM data is organized as node/way/area which we know as `POINT`/`LINESTRING`/`POLYGON` --- # Raster Vector Realations - Vector data (like OSM) can be used to summarize or ask questions about raster data: -- - `raster::extract`: extracts cell values that intersect with a geometery - `fasterize::fasterize`: convert vector to raster) - `textractr::exact_extract`: performs zonal summaries for a feature set --- # Day #19: Map Alegra and OSM - **Local** operations are applied to each individual cell and only involve those cells sharing the same location. -- - **Focal** operations assigns summary values to the output cells based on the neighboring cells in the input raster. **Requires a window and a reducer** -- - **Zonal** operations compute a summary values (such as the mean) from cells aggregated to some zonal unit. -- - **Global** operations make use of some or all input cells when computing an output cell value. --- # Day #20: Categorization - A common task (arguably all of remote sensing) is about understanding and classifiying/categorizing patterns that occur -- - This process is about reducing the dinimsionality or the noise in a dataset -- - We looked at the `kmeans` algorithm which is an unsupervised classification method.  -- - Other more technical techniques include random forest, decision tree, and other clustering algorithms --- # Day #21: Terrain Analysis - Terrain analysis is a common task to make sense of elevation data. -- - In its own right is a form of classification -- - Terrain analysis implements complex (e.g. 3d-finite difference) neighborhood functions -- - Specifically we looked at `hillshade`, `slope`, `aspect`, and `HAND` -- - We can speed these processes up by using `whitebox` -- - Using `whitebox` introduced a second valuable skill about interfacing with _command line utilities_ which require path names rather then in memory objects as input (this is largley how ArcMap works!) -- - These types of tools are one way of locally speeding up complex/intensive calculations --- # Day #22: Google Earth Engine - A remote solution to speed up intensive raster calculations -- - Upcoming integration with AI and ML via TensorFlow -- - The mentioned forest analysis: 700,000,000,000,000 pixels! -- - We also saw that the spatial implementation was not different (just javascript syntax) -- - properties/attributes, - working environment, - variables, - assignment, - WKT, - filter, - reducers (summarize), - indexing ([]) --- class: center, middle # [Lab 6](lab-06.html) --- class: center, middle # [Final](final.html) --- # Grades - The class is out of 1000 points - All said, 1120 points were offered - Your score will be your total points divided by 1000 - The last 15 are class based and depends if we hit 90% completion on the ESCI forms (is extra credit) --- # Thank you ### Two great TAs - Jiwon Baik - Matthew Feliciano -- ### Instructional Assistant - Ryan Erickson -- ### Guest Lecture - Jim Coll -- ### All of you --- # The class is not over... - Always feel free to reach out with questions about GIS, R, grad school, ect --- # Go forth and keep coding!


Serverless Workflows
Allow users to consume applications in an opinionated way without provisioning servers.
PushToCompute™
Enable developers to deploy applications as opinionated workflows for those users.
Benefits of PushToCompute™
- Turn-key CI/CD Service
- Maintain developer velocity
- Ship complete environments, not just an installer
- Reduce support overhead for software vendors
- Declarative application versioning
What is PushToCompute™?
Package, deploy and release on JARVICE.
- PACKAGE your application environment (OS + Config) using Docker, Git and JSON AppDef
- DEPLOY opinionated workflows using Docker and the PushToCompute™ Build Service
- RELEASE cloud applications to the app catalog, and optionally monetize your apps.
PushToCompute™
What is a Workflow?
A workflow is a combination of:
- an application (OS + environment + application binaries)
- its action
- the hardware it runs on
- input data
- output data
Examples of Workflows
Examples of Workflows
- Launch a cluster of NVIDIA P100s and run Kinetica's real-time analytics GPU DB.
- Launch NVIDIA DIGITS web application on an NVIDIA DGX-1.
Examples of Workflows
- Configure a model for a parameterized aerodynamics simulation.
- Run a computational fluid dynamics simulation in batch mode on a cluster.
Examples of Workflows
- Run an algorithm in MATLAB with a GPU for a few hours
- Run MATLAB with minimal hardware requirements to review results.
Examples of Workflows
- Train a Deep Learning model using 20 GB of training input data.
- Train a Deep Learning model using 500 GB of training input data using a newly-released GPU type.
- Run an MPI-based application appropriately sized for their input data set.
Common Workflow Architectures
- BATCH Run a single, parameterized command, and exit
- DESKTOP INTERACTIVE Run an application in a remote desktop
- WEB INTERACTIVE Run a single-tenant web application
- DEVELOPER ENVIRONMENT Launch a configured server with SSH access
- SERVICE Start a web service and run indefinitely
### Tutorial
Objective: Build a workflow with two commands:
1. A batch endpoint to "stylize" an image using https://github.com/jcjohnson/neural-style
1. A Desktop GUI application that displays the image.
![jarvice](images/jarvice-side-by-side.png)
### Prerequisites
In order to follow along in this tutorial, you'll need accounts on the following services:
1. [JARVICE](https://mc.jarvice.com)
1. [DockerHub](http://dockerhub.com)
1. [Github](http://www.github.com)
Fork the Github repo at [https://github.com/nimbix/nds17](https://github.com/nimbix/nds17)
Step 1: "Hello, JARVICE"
We pull an image from DockerHub and run it on JARVICE with the default AppDef.
Step 1: "Hello, JARVICE"
Pull the Docker Image
- Log in to the Material Compute interface at https://mc.jarvice.com
- In the PushToCompute section, select "New" to create a new PushToCompute App
- Docker Registry: nimbix/ubuntu-desktop:trusty
- Monitor the status of the pull in the History Window
### Step 1: "Hello, JARVICE"
#### Run Some Commands
5. Click the app card and select "batch".
6. Enter `echo "hello, jarvice"` and select the n0 machine.
7. Try running other commands:
* `cat /etc/JARVICE/cores`
* `cat /etc/JARVICE/nodes`
* `cat /etc/JARVICE/jobinfo.sh`
8. (Exercise) Try running "Server" and connecting to the Nimbix desktop interactively.
Step 2: Build an application from an app repository on Github
https://github.com/nimbix/nds17
Note If you would like to follow along by editing the repository, please fork this repository now.
Step 2: Build an application from an app repository on Github
- In PushToCompute, connect a DockerHub account.
- Create a new app:
- Docker Repository YourDockerHubUserName/nds17
- Git Source URL
git@github.com:nimbix/nds17.git
### Step 2: Build an application from an app repository on Github
#### Build with the PushToCompute Build Service
1. From the app card, select "build and pull"
1. Check the commands. These are defined in /etc/NAE/AppDef.json.
1. The custom image is defined in /etc/NAE/screenshot.png
Check the [Dockerfile](https://github.com/nimbix/nds17/blob/master/Dockerfile) and [AppDef](https://github.com/nimbix/nds17/blob/master/NAE/AppDef.json)
*Note*: This is like running `docker build`
### Step 3: Customize your Dockerfile
Nimbix has many base images. `docker search nimbix`
Common base images include:
* nimbix/ubuntu-desktop
* nimbix/base-ubuntu-nvidia (NVIDIA CUDA base images with Nimbix extras)
* nimbix-ubuntu-base
* nimbix/centos-desktop
* nimbix/centos-base
We've built a special base image for today's workshop: `jarvice/base-nds17`
```FROM jarvice/base-nds17```
* [Torch](http://torch.ch/) is a library that is popular for scientific computing and deep learning. We have built a special Torch base image that is pre-configured for use on NIMBIX with GPU-capable Torch.
* [jcjohnson/neural-style](Neural Style) An implementation of image stylization in Torch. It is open source at https://github.com/jcjohnson/neural-style
[Dockerfile](https://github.com/nimbix/nds17/blob/master/Dockerfile)
```bash
FROM jarvice/base-nds17
RUN apt-get update && \
apt-get install -y pinta curl && \
apt-get clean
COPY ./NAE/AppDef.json /etc/NAE/AppDef.json
RUN curl --fail -X POST \
"https://api.jarvice.com/jarvice/validate" \
<EMAIL_ADDRESS>COPY ./NAE/screenshot.png /etc/NAE/screenshot.png
COPY ./scripts/stylize.sh /usr/local/scripts/stylize.sh
```
### Step 4: Define the application workflows
We want to be able to run the following command:
```th neural_style.lua -style_image style.jpg -content_image content.jpg```
So, let's build an [AppDef](https://github.com/nimbix/nds17/blob/master/NAE/AppDef.json) that does this.
```th neural_style.lua -style_image style.jpg -content_image content.jpg```
```javascript
"stylize": {
"path": "/usr/local/scripts/stylize.sh",
"interactive": false,
"name": "Stylize an Image",
"description": "Style an image using TORCH-based Neural Style",
"parameters": {
"-style_image": {
"type": "FILE",
"required": true,
"name": "Style image",
"description": "The image to base the new style on",
"filter": "*.png|*.jpg"
},
"-content_image": {
"type": "FILE",
"required": true,
"name": "Content image",
"description": "The image that will be stylized",
"filter": "*.png|*.jpg"
}
},
"machines": [
"ng*"
]
}
```
COPY ./NAE/AppDef.json /etc/NAE/AppDef.json
[Dockerfile](https://github.com/nimbix/nds17/blob/master/Dockerfile)
```bash
FROM jarvice/base-nds17
RUN apt-get update && \
apt-get install -y pinta curl && \
apt-get clean
COPY ./NAE/AppDef.json /etc/NAE/AppDef.json
RUN curl --fail -X POST \
"https://api.jarvice.com/jarvice/validate" \
<EMAIL_ADDRESS>COPY ./NAE/screenshot.png /etc/NAE/screenshot.png
COPY ./scripts/stylize.sh /usr/local/scripts/stylize.sh
```
```bash
#!/bin/bash
# NDS17 PushToCompute Workshop
. /usr/local/torch/install/bin/torch-activate
cd /usr/local/neural-style/neural-style
th neural_style.lua -backend cudnn -output_image /data/stylized.png $@
```
COPY ./scripts/stylize.sh /usr/local/scripts/stylize.sh
If you forked the Github repository, push your changes and rebuild
git push origin master
Then go back to https://mc.jarvice.com to build and pull
### Step 5: A Better Workflow
```javascript
"stylize": {
"path": "/usr/local/scripts/stylize.sh",
"interactive": false,
"name": "Stylize an Image",
"description": "Style an image using TORCH-based Neural Style",
"parameters": {
"-style_image": {
"type": "SELECTION",
"required": true,
"name": "Style image",
"description": "The image to base the new style on",
"values": [
"Starry Night",
"Picasso",
"8-bit JARVICE"
],
"mvalues": [
"/usr/local/styles/starrynight.png",
"/usr/local/styles/picasso.png",
"/usr/local/styles/jarvice.png"
],
},
"-content_image": {
"type": "FILE",
"required": true,
"name": "Content image",
"description": "The image that will be stylized",
"filter": "*.png|*.jpg"
}
},
"machines": [
"ng4",
"ng5",
"ngd4",
"ngd5"
]
}
```
### Step 6: Releasing on JARVICE
Ensure that your application has all of the proper metadata set:
* /etc/NAE/AppDef.json
* /etc/NAE/screenshot.png
* /etc/NAE/help.html
* Categories are set in the AppDef
### Step 6: Releasing on JARVICE
#### Monetization Options
* Pass-through license uplift cost = money in your pocket proportional to utilization
* Applies proportionally to the number of total CPU cores
### Step 6: Releasing on JARVICE
#### Community Apps vs Certified Apps
* Certified Apps: Nimbix provides first-line support for Certified applications. This requires a business agreement, test cases to verify the application's exisiting workflows and information on how to use the application.
* Community Apps: Community apps are apps for which support is provided by the application owner.
#### Best Practices and Examples
See examples at [Nimbix GitHub space](https://github.com/nimbix)
* Remote visualization application: [ParaView](https://github.com/nimbix/app-paraview)
* Batch and interactive processing: [Canu Pipeline](https://github.com/nimbix/app-canupipeline)
* Ephemeral developer environment: [PowerAI](https://github.com/nimbix/powerai)
* Web service application: [DIGITS](https://github.com/nimbix/app-digits)


{% extends 'registration/registration_base.html' %} {% block main %}
You have successfully logged out.


I Never Really Did Leave......
I am an ex-freak (ok i am still a freak, but I dont trip any more except for the occasional 'e'). I am 26 now, but between 17 and 23 years I tripped on LSD probably a couple of hundred times or more, with plenty of speed, ecstacy etc to taste. Some trips were devastating, some corny (pretty patterns, thinking I had found the meaning of life, blah blah). I also indulged in mushrooms when possible (maybe a couple of dozen times), although I haven't found them particularly easy to come by, which is a pity cos I think they're lovely. I had quite a taste for psychoactive substances and even though I seemed to have more than my fair share of scary trips (maybe cos I didnt check my dosages sensibly), I liked it like I like rollercoasters. I always took something from the experience and I always came back for more.
I have found that since my days of warping the way I see the world, my vision never really went back to 'normal'. As in I still get visual distortions despite even having given up my bong :o( I was a serious bonger for 10 years, being a bit of a lightweight when it comes to tobacco, I had to smoke my dope pure. Even after adopting my straight life - I am now a computer programmer (check out the cliche, I got fat!), and many of my peers consider me to be pretty good at what I do - I was still smoking bongs before meetings with managers at work, at 3 in the morning, before going jogging etc. Even my smoker mates could never understand how I could get fully stoned before doing these things and maybe you dont either. Anyway Im going off-track (ok so my mind never did fully straigten out I am still Mr Tangent).
Things wobble for me. I get tracers sometimes. I see things moving from the corner of my eye, then when I look at them properly I realise they are solid objects. I see cats that turn out to be shadows when I turn around to face them. I get noise in my vision sometimes (it's always there if I choose to see it if you know what I mean). Some days things simply have a haze over them. Despite this I don't think there is a physical problem with my eyes - in comparison with many of my friends it often seems that especially my long-distance vision is very good.
I also have an artistic leaning - I paint, and although I mentioned I am a programmer, I am also a web designer so much of my time still revolves around making things look good. I dont happen to think that my 'sparkly spectacles' cause me a problem (although if you ever see me piloting a plane you are about to board, take the boat instead for your own safety).
Everybody sees the world in his or her own way. One person's green is another person's turquoise is another person's blue. If I look at a brick wall and maybe the ridges are rippling a little I can pretty much rest assured that the ripple is actually occurring somewhere between my eyes and my brain. It makes things more interesting anyway.
Sometimes I make a bit of a fool of myself because of my slippery mind (like when I asked my flatmate if the landlord had sorted out a key for our windows yet - I didnt understand her confused expression until I realised that I was thinking about the last flat I lived in, over a year ago, with a different person!) but generally its good for a laugh and not many people run away screaming.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


#45 Rue Grand Yorf, DAKAR, SENEGAL. Assalamaulakum. My Dear Friend, Compliments of the day.I did like to send to you the best wishes of good health and success in your pursuits particularly through my proposal as contained in this letter. After due deliberation with my son,I decided to forward to you this business proposal, we want you to assist us .I will give you more information. As to this regard as soon as you reply. I am Mrs.Estelle Mamadou . I am contacting you with the hope that you will be of great assistance to me, I currently have within my reach the sum of 7.3 million U.S dollars cash which I intend to use for investment purposes. I therefore personally appeal to you seriously and religiously for your urgent assistance to move this money in to your country where I believe it will be safe since I cannot leave the country due to the restriction of movement imposed on the members of my family by the Senegal Government. This money came as a result of a payback contract deal between my husband and a Russian firm in our country.The Russian partners returned my husbands share .Presently, the Government has intensified their probe in to my husbands financial resources which has led to the freezing of all our accounts, local and foreign, the revoking of all our business licences and the arrest of my First son. In view of this I want to acted very fast to withdraw this money from one of our finance houses before it will be closed down.My husband deposited the money in a finance firm for safe keeping . No record is known about this fund by the government because there is no documentation showing that we have such funds. Further more, my elder son have been in detention in the last four years following the death of my late husband for charges of State organized murder and corrupt practices. he was just been released by the Supreme Court after the president brokered a deal with my family regarding his freedom. and he is still under interrogation about my late husband's assets and some vital documents. Due to the current situation in the country and government attitude to my family,I cannot make use of this money within, thus I seek your help in transferring this funds out for investment than leaving the fund here and to invest the money to profit my family Bearing in mind that you may assist me.l have decided to part with 25% of the total sum. I am seriously considering to settle down abroad in a friendly atmosphere like yours as soon as this fund get into your account so that I can start all over again if only you wish. I shall ask my son Mohammade to come over to your country to liaise with you. If this proposal satisfies you. please do not let me out to the security as I am giving you this information in total trust and confidence. Please kindly reply by return mail and please include your personal telephone and fax numbers. Conclusively,we have decided part with 25% of the total sum. of the total sum,10% will be for expenses incurred during thecause of this transaction, while 65% is to be held on trust by you until we can decide on a suitable business investment in your country subsequent to our free movement by the Senegal Government. I will greatly appreciate if you accept my proposal in good faith. Your URGENT response is needed. Regards and God Bless you. Mrs.Estelle Mamadou . _________________________________________________________________ Découvrez Windows Live Messenger : le futur de MSN Messenger ! www.windowslivemessenger.fr


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.sling.commons.threads.ThreadPoolConfig
public final class ThreadPoolConfig
The ThreadPool configuration.
| Nested Class Summary | |
|---|---|
static class |
ThreadPoolConfig.ThreadPoolPolicy
The thread pool policies. |
static class |
ThreadPoolConfig.ThreadPriority
|
| Constructor Summary | |
|---|---|
ThreadPoolConfig()
Create a new default configuration. |
|
ThreadPoolConfig(ThreadPoolConfig copy)
Clone an existing configuration |
| Method Summary | |
|---|---|
protected void |
checkWritable()
|
ThreadPoolConfig.ThreadPoolPolicy |
getBlockPolicy()
|
java.util.concurrent.ThreadFactory |
getFactory()
|
long |
getKeepAliveTime()
|
int |
getMaxPoolSize()
|
int |
getMinPoolSize()
|
ThreadPoolConfig.ThreadPriority |
getPriority()
|
int |
getQueueSize()
|
int |
getShutdownWaitTimeMs()
|
boolean |
isDaemon()
|
boolean |
isShutdownGraceful()
|
void |
makeReadOnly()
Make the configuration read-only. |
void |
setBlockPolicy(ThreadPoolConfig.ThreadPoolPolicy blockPolicy)
|
void |
setDaemon(boolean isDaemon)
|
void |
setFactory(java.util.concurrent.ThreadFactory factory)
|
void |
setKeepAliveTime(long keepAliveTime)
|
void |
setMaxPoolSize(int maxPoolSize)
|
void |
setMinPoolSize(int minPoolSize)
|
void |
setPriority(ThreadPoolConfig.ThreadPriority priority)
|
void |
setQueueSize(int queueSize)
|
void |
setShutdownGraceful(boolean shutdownGraceful)
|
void |
setShutdownWaitTimeMs(int shutdownWaitTimeMs)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ThreadPoolConfig()
public ThreadPoolConfig(ThreadPoolConfig copy)
copy
- The config to clone| Method Detail |
|---|
protected void checkWritable()
public void makeReadOnly()
public int getMinPoolSize()
public void setMinPoolSize(int minPoolSize)
public int getMaxPoolSize()
public void setMaxPoolSize(int maxPoolSize)
public int getQueueSize()
public void setQueueSize(int queueSize)
public long getKeepAliveTime()
public void setKeepAliveTime(long keepAliveTime)
public ThreadPoolConfig.ThreadPoolPolicy getBlockPolicy()
public void setBlockPolicy(ThreadPoolConfig.ThreadPoolPolicy blockPolicy)
public boolean isShutdownGraceful()
public void setShutdownGraceful(boolean shutdownGraceful)
public int getShutdownWaitTimeMs()
public void setShutdownWaitTimeMs(int shutdownWaitTimeMs)
public java.util.concurrent.ThreadFactory getFactory()
public void setFactory(java.util.concurrent.ThreadFactory factory)
public ThreadPoolConfig.ThreadPriority getPriority()
public void setPriority(ThreadPoolConfig.ThreadPriority priority)
public boolean isDaemon()
public void setDaemon(boolean isDaemon)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


3 R recap
In LIFE223, we taught you how to use R for statistical analysis and visualising data. This chapter will contain a basic overview of some of the things from 223 that you may find useful as we proceed. You only need to bother with this if you are new to R or have blocked it from your memory since you last used it.
3.1 Basics
R works well as a calculator.
[1] 42
However, R is capable of a great deal more than just simple mathematical operations like multiply and divide. It also has functions that can calculate some common descriptive stats like mean and standard deviation.
[1] 42.00764
[1] 4.226391
3.1.1 Plotting
R is also a very flexible graphical tool. From LIFE223, you probably remember a few basic plotting functions. Each function in R has arguments that can be added to label axes or change point size as you can see in these plots.
For much of this book, I will actually be doing most plotting in a package called ggplot2 (Wickham 2016). This package has a slightly different syntax to get used to but the increased flexibility you have will be a good payoff. Plus the plots look quite nice.
For all the details on how to use ggplot2, have a look at this bookdown all about visualising data using ggplot2.
3.1.2 The working directory
The working directory is the folder on your computer where R’s attention is focused. This is where you should store any files you need R to open. You can find out the path of the current working directory using the function getwd()
[1] "/Users/chrismitchell/Google Drive/University of Liverpool/GitHub Stuff/bookdownCRG"
If this isn’t the folder we want as our working directory, we can just as easily change it with setwd()
If you are using RStudio there is also a shortcut to do this in the Files pane (usually bottom right). Use this pane to navigate to your chosen directory and then use the drop down menu under More (look for a blue cog) to set the current folder as your working directory.
If you aren’t using RStudio, I’d strongly suggest you start. It’s much more user friendly than base R.
3.1.3 Loading data
Data comes in many forms and R is capable of reading most of them if you know the correct functions. One of the most common formats is comma separated values. This has the file extension .csv at the end of the filename. If you open a .csv file with MS Excel or Numbers, you will see that it usually looks much like a spreadsheet. To load a .csv data file into R, use the function read.csv() as shown here.
For other data formats, you may require a different function. For example, data may be provided as a text file (extension .txt). In this case, you need read.table(). Note that with this function you need to specify that your data has a header (a top row with names for columns) whereas read.csv() assumes this by default.
3.1.4 Subsetting
Let’s say I want to subset my data based on a certain condition. I can achieve this multiple ways but one of the simplest is the function subset.
This function takes a subset of the object data and applies the rule that the value of each row in the column species be Homo sapiens. Thus it extracts the lines of data that are from human beings.
3.2 Errors
Error messages are a part of life with R.
Here’s a basic error message:
Warning in file(file, "rt"): cannot open file 'mydaat.csv': No such file or
directory
Error in file(file, "rt"): cannot open the connection
The message tells me that R “cannot open the connection” and no such file exists. This means that R cannot find the file I was looking for in the current working directory. It could be because I haven’t set the correct working directory or the file is there but in a different format. In this case, the error has appeared because I have spelled the name incorrectly. I have sent R looking for a file called mydaat.csv instead of mydata.csv.  It may seem odd but almost any problem you will ever encounter with R can be solved by a quick Google search.
If you come up against a confusing error message, copy and paste the message into Google. You will quickly land on one of the forums where someone else has asked about the same error message. The odds are pretty good you’ll discover an explanation for the problem there.
If you don’t know how to do something, pop the name of what you want to do into Google and add “in R” at the end and there will almost always be a tutorial on the first page of results with exactly what you need.
Seriously, Google is your strongest ally here. The community of R users has populated the internet with endless advice and guidance for every level from beginner to the most advanced of users. That brings me to my next point…
3.4 Stealing
If imitation is the greatest form of flattery then learning to code in R is just about the most flattering thing you can do. The internet is teeming with examples of R code for all kinds of purposes including in this very book. Take it without thinking twice.
You will have acheived a pretty good level of skill in R when you can take someone else’s code and edit it for your own purposes. This is the core skill of R and once you can do that, you’ll be unstoppable.
Bibliography
Wickham, H. (2016) Ggplot2: Elegant Graphics for Data Analysis [online] Springer-Verlag New York. available from <https://ggplot2.tidyverse.org>


Court remands trader for ‘chewing’ cop’s finger
A trader who allegedly chewed off the forefinger of a police officer has been remanded by an Accra Circuit Court.
General Sergeant Kwame Abu together with other officers had gone to effect the arrest of the suspect, Promise Anoma, but during a scuffle, his forefinger slipped into the suspect’s mouth and he sank his teeth into it.
Chief Inspector Emmanuel Ohene Agyei who is prosecuting the case told the court presided over by Mrs. Jane Harriet Akweley Quaye that on November 03, 2019, together with three other officers had gone to arrest the accused whom a witness had reported a case against at the Nungua Police station.
According to the prosecutor, when the officers arrested the suspect and were leading him to their vehicle he requested to make a call but was told he could make the call while in the vehicle.
The suspect, however, refused to join the vehicle and attacked one of the officers.
Sergeant Abu, however, prevented him from doing so and in the process, his forefinger slipped into the mouth of suspect mouth who sank his teeth into it and bit it off.
The officers, therefore, called for reinforcement to transport the suspect to the Police Station.
Meanwhile, the 25-year-old Promise Anoma, has pleaded not guilty to resisting arrest and causing harm and will reappear before the court on Friday, November 29.


Exclude trivial rebases from triggering build
If set, this will ignore any patchset which Gerrit considers a "trivial rebase" from triggering this build. These patches were able to be rebased without conflict by Gerrit.


Connect to Microsoft OneDrive to open files in Microsoft 365
Unable to connect to OneDrive. Please try again.
To edit files in Microsoft 365, they need to be stored in Microsoft OneDrive
cloud storage. If you open a file not already in OneDrive, your Chromebook
can move it for you.
Learn more
You'll need to sign in with your Microsoft account to continue.


ofTexture
ofTexture is used to create textures that live on your graphics card from bitmap data that can then be used to fill other drawn objects, like a bitmap fill on a rectangle. When you draw an ofImage, you're actually just drawing a rectangle of points and then using an ofTexture to fill the space between those points. At it's core, ofTexture is a wrapper for OpenGL textures. It allows us of non-power of 2 textures in opengl, and to upload and draw graphical data.
- allocate(...)
- bAllocated()
- clear()
- draw(...)
- drawSubsection(...)
- getCoordFromPercent(...)
- getCoordFromPoint(...)
- getHeight()
- getWidth()
- isAllocated()
- loadData(...)
- loadScreenData(...)
- operator=(...)
- setCompression(...)
- setTextureMinMagFilter(...)
- setTextureWrap(...)
- setUseExternalTextureID(...)
- ofDisableArbTex()
- ofDisableNormalizedTexCoords()
- ofDisableTextureEdgeHack()
- ofEnableArbTex()
- ofEnableNormalizedTexCoords()
- ofEnableTextureEdgeHack()
- ofGetGlFormatAndType(...)
- ofGetGlInternalFormat(...)
- ofGetImageTypeFromGLType(...)
- ofGetUsingArbTex()
- ofGetUsingCustomMinMagFilters()
- ofGetUsingCustomTextureWrap()
- ofGetUsingNormalizedTexCoords()
- ofRestoreMinMagFilters()
- ofRestoreTextureWrap()
- ofSetMinMagFilters(...)
- ofSetTextureWrap(...)
ofTexture methods
allocate(...)
void ofTexture::allocate(int w, int h, int glInternalFormat)
This is the call to allocate opengl texture. The width (w) and height (h) do not necessarily need to be powers of 2, but they do need to be large enough to contain the data you will upload to the texture. The internal data type describes how opengl will store this texture internally. For example, if you want a grayscale texture, you can use "GL_LUMINANCE". You can uplaod what ever type of data you want (using loadData()) but internally, opengl will store the information as grayscale. Other types include: GL_RGB, GL_RGBA. You need to allocate the texture before drawing it or loading data into it. uses the currently set OF texture type - default ARB texture
allocate(...)
void ofTexture::allocate(int w, int h, int glInternalFormat, bool bUseARBExtention)
See previous allocate for knowing the behaviour of this function. The parameter bUseARBEExtension allow the user to enable the ARBE extension for this texture. You need to allocate the texture before drawing it or loading data into it, lets you overide the default OF texture type
clear()
void ofTexture::clear()
clears / frees the texture memory, if something was already allocated. useful if you need to control the memory on the graphics card. Clears all the data from the texture
draw(...)
void ofTexture::draw(float x, float y, float w, float h)
draws the texture at a given point (x,y), with a given width (w) and height (h). Draws the texture at the x, y and w, h.
draw(...)
void ofTexture::draw(float x, float y)
Draws the texture at a given point (x,y), using the textures true width and height. Draws the texture at the point passed in.
draw(...)
void ofTexture::draw(float x, float y, float z, float w, float h)
Draws the texture at the x, y, z in 3D space with the width and height at w,h.
draw(...)
void ofTexture::draw(float x, float y, float z)
Draws the texture at the point passed in in 3D space.
draw(...)
void ofTexture::draw(const ofPoint &p1, const ofPoint &p2, const ofPoint &p3, const ofPoint &p4)
Draws the texture at 4 poitns passed in as if you created 4 glVertices.
drawSubsection(...)
void ofTexture::drawSubsection(float x, float y, float w, float h, float sx, float sy)
drawSubsection(...)
void ofTexture::drawSubsection(float x, float y, float z, float w, float h, float sx, float sy)
drawSubsection(...)
void ofTexture::drawSubsection(float x, float y, float w, float h, float sx, float sy, float sw, float sh)
drawSubsection(...)
void ofTexture::drawSubsection(float x, float y, float z, float w, float h, float sx, float sy, float sw, float sh)
getCoordFromPoint(...)
ofPoint ofTexture::getCoordFromPoint(float xPos, float yPos)
these are helpers to allow you to get points for the texture ala "glTexCoordf" but are texture type independent. use them for immediate or non immediate mode
getHeight()
float ofTexture::getHeight()
Returns the height of the texture. This will be in pixels unless you've set your application to use normalized coordinates.
getWidth()
float ofTexture::getWidth()
Returns the width of the texture. This will be in pixels unless you've set your application to use normalized coordinates.
isAllocated()
bool ofTexture::isAllocated()
Get whether the texture has been allocated. ofTextureData getTextureData() ### // reference to the actual textureData inside the smart pointer // for backwards compatibility ofTextureData texData ### float getHeight() ### float getWidth() ###
loadData(...)
void ofTexture::loadData(unsigned char * data, int w, int h, int glDataType)
Loads into the texture the array of unsigned chars (data), with a given width (w) and height (h). You also pass in the format that the data is stored in (some options: GL_LUMINANCE, GL_RGB, GL_RGBA). For example, to upload a 200*100 pixel RGB array into an already allocated texture:
unsigned char pixels[200*100];
for (int i = 0; i < 200*100; i++){
pixels[i] = (int)(255 * ofRandomuf());
}
myTexture.loadData(pixels, 200, 100, GL_RGB);
loadScreenData(...)
void ofTexture::loadScreenData(int x, int y, int w, int h)
Grabs a region of the screen and loads it into the texture. Specifiy the position (x,y) you wish to grab from, with the width (w) and height (h) of the region. Make sure that you have allocated your texture (using allocate()) to be large enough to hold the region of the screen you wish to load. Load data from the current screen into this texture. Grabs a region of the screen and loads it into the texture. Specifiy the position (x,y) you wish to grab from, with the width (w) and height (h) of the region. Make sure that you have allocated your texture (using allocate()) to be large enough to hold the region of the screen you wish to load.
operator=(...)
ofTexture & ofTexture::operator=(const ofTexture & mom)
Makes the current ofTexture a copy of another ofTexture. e.g:
ofTexture text1,text2;
//we modify here text1 texture
text2 = text1;
text2 and text1 are now identical.
Let's you do
tex2 = tex1;
setTextureMinMagFilter(...)
void ofTexture::setTextureMinMagFilter(GLint minFilter, GLint maxFilter)
Set how the texture is scaled up and down, when it's being drawn larger or smaller than it's actual size.
setTextureWrap(...)
void ofTexture::setTextureWrap(GLint wrapModeHorizontal, GLint wrapModeVertical)
Sets how the texture wraps around the edges of the vertices that the texture is being drawn to.
ofTexture functions
ofEnableArbTex()
void ofEnableArbTex()
ofEnableArbText enables the use of ARB textures. ARB textures enable the creation of non power of 2 sized textures.
ofGetGlFormatAndType(...)
void ofGetGlFormatAndType(int glInternalFormat, int &glFormat, int &glType)
ofSetMinMagFilters(...)
void ofSetMinMagFilters(GLfloat minFilter=GL_LINEAR, GLfloat maxFilter=GL_LINEAR)
ofSetTextureWrap(...)
void ofSetTextureWrap(GLfloat wrapS=GL_CLAMP_TO_EDGE, GLfloat wrapT=GL_CLAMP_TO_EDGE)