v_sim.Plane

g GObject.GInterface GObject.GInterface v_sim.Animatable v_sim.Animatable GObject.GInterface->v_sim.Animatable v_sim.Boxed v_sim.Boxed GObject.GInterface->v_sim.Boxed GObject.Object GObject.Object v_sim.Plane v_sim.Plane GObject.Object->v_sim.Plane v_sim.Animatable->v_sim.Plane v_sim.Boxed->v_sim.Plane

Subclasses:

None

Methods

Inherited:

GObject.Object (37), v_sim.Animatable (6), v_sim.Boxed (2)

Structs:

v_sim.PlaneClass (1), GObject.ObjectClass (5)

class

getOrderedIntersections (nVisuPlanes, listOfVisuPlanes, pointA, pointB, inter, index)

class

new (box, vect, dist, color)

class

newUndefined ()

getBasis (xyz, center)

getColor ()

getDistanceFromOrigin ()

getHiddenState ()

getLineIntersection (A, B)

getNVect (vect)

getNVectUser (vect)

getOpacity ()

getPlaneIntersection (plane2)

getReducedIntersection (nVals)

getRendered ()

getVisibility (point)

setColor (color)

setDistanceFromOrigin (dist)

setHiddenState (side)

setNormalVector (vect)

setOpacity (opacity)

setOrigin (origin)

setRendered (rendered)

Virtual Methods

Inherited:

GObject.Object (7), v_sim.Boxed (1)

Properties

Inherited:

v_sim.Boxed (2)

Name

Type

Flags

Short Description

color

v_sim.Color

r/w

rendering color

distance

float

r/w

distance to origin

hidding-side

int

r/w

hidding property

n-vector

r/w

normal vector

opacity

float

r/w

opacity property

rendered

bool

r/w

rendering property

Signals

Inherited:

GObject.Object (1), v_sim.Animatable (1), v_sim.Boxed (1)

Name

Short Description

moved

This signal is emitted each time the plane position is changed (either distance or normal).

rendering

This signal is emitted each time the rendering properties (color, visibility…) are affected.

Fields

Inherited:

GObject.Object (1), v_sim.Animatable (1), v_sim.Boxed (1)

Class Details

class v_sim.Plane(**kwargs)
Bases:

GObject.Object, v_sim.Animatable, v_sim.Boxed

Abstract:

No

Structure:

v_sim.PlaneClass

All fields are private, use the access routines.

classmethod getOrderedIntersections(nVisuPlanes, listOfVisuPlanes, pointA, pointB, inter, index)
Parameters:
  • nVisuPlanes (int) – the number of planes (must be consistent with the number of planes in listOfVisuPlanes!)

  • listOfVisuPlanes (v_sim.Plane) – an array of v_sim.Plane, None terminated ;

  • pointA (float) – three cartesian coordinates.

  • pointB (float) – three cartesian coordinates.

  • inter (float) – a pointer to the location to store the intersection points. Supposing you know the number of intersection points !

  • index (int) – a pointer to the location to store the indices of ordering of the planes.

Returns:

True if the intersections are found.

Return type:

bool

Compute the location of the intersection points of segment AB with list of planes listOfVisuPlanes. If there are several intersections, they are ordered by the proximity to point A.

classmethod new(box, vect, dist, color)
Parameters:
  • box (v_sim.Box or None) – a box description ;

  • vect ([float]) – three values defining the normal vector (unitary or not) ;

  • dist (float) – the distance between origin and intersection of the plane and the line made by origin and normal vector ;

  • color (v_sim.Color) – a v_sim.Color.

Returns:

a newly allocated v_sim.Plane structure.

Return type:

v_sim.Plane

Create a plane with the specified attributes.

classmethod newUndefined()
Returns:

a newly allocated v_sim.Plane structure.

Return type:

v_sim.Plane

Create a new plane with default values. This plane can’t be rendered directly and one needs to computes its intersection with the bounding box before using planeComputeInter().

getBasis(xyz, center)
Parameters:
  • xyz (float) – two vectors.

  • center (float) – a point in cartesian coordinates.

Stores the coordinates of barycentre of the plane in center and provide coordinates of two orthogonal vector in the plane. The planeComputeInter() should have been called before.

getColor()
Returns:

a v_sim.Color.

Return type:

v_sim.Color

Stores the color of the plane.

getDistanceFromOrigin()
Returns:

a float value.

Return type:

float

Stores the distance of the plane to the origin.

getHiddenState()
Returns:

the state, defined by v_sim.PLANE_SIDE_PLUS or v_sim.PLANE_SIDE_MINUS or v_sim.PLANE_SIDE_NONE.

Return type:

int

The plane can hide the nodes on one of its side. this method get the status for the given self.

getLineIntersection(A, B)
Parameters:
  • A ([float]) – coordinates of point A.

  • B ([float]) – coordinates of point B.

Returns:

True if there is an intersection between line (AB) and the plane.

lambda_:

a location to store the intersecting factor.

Return type:

(bool, lambda_: float)

If there is an intersection M between line (AB) and self, then this function calculates M coordinates as M = A + lambda * AB.

New in version 3.6.

getNVect(vect)
Parameters:

vect (float) – an already alloacted (size 3) float array.

Stores the coordinates of the normal vector in vect of the plane. It returns the normalized values.

getNVectUser(vect)
Parameters:

vect (float) – an already alloacted (size 3) float array.

Stores the coordinates of the normal vector in vec of the plane. It returns the values given by the user, not the normalized vaues.

getOpacity()
Returns:

a float within [0;1].

Return type:

float

Retrieves the plane opacity.

New in version 3.8.

getPlaneIntersection(plane2)
Parameters:

plane2 (v_sim.Plane) – another v_sim.Plane object.

Returns:

True if there is an intersection between self and plane2.

A:

the coordinates of the first point of intersection.

B:

the coordinates of the second point of intersection.

Return type:

(bool, A: [float], B: [float])

Calculates the intersection between self and plane2, if it exists. The intersection is returned in A and B as the coordinates of the two points on the border of self that intersect plane2.

New in version 3.7.

getReducedIntersection(nVals)
Parameters:

nVals (int) – a location for an integer.

Returns:

a newly allocated array of nVals * 2 values. Free it with GLib.free().

Return type:

float

This routine returns the coordinates in the self basis set of its intersections with a box (see v_sim.Boxed.setBox()). The coordinates are appended in the return array which length is stored in nVals.

New in version 3.6.

getRendered()
Returns:

True if the plane is visible.

Return type:

bool

Get the visibility of a plane.

getVisibility(point)
Parameters:

point ([float]) – some coordinates.

Returns:

True if the given point is not masked by the self.

Return type:

bool

Test the visibility of a given point with respect to the plane attributes.

New in version 3.8.

setColor(color)
Parameters:

color (v_sim.Color) – a v_sim.Color.

Returns:

True if color changed.

Return type:

bool

Change the color of the plane.

setDistanceFromOrigin(dist)
Parameters:

dist (float) – the distance between origin and intersection of the plane and the line made by origin and normal vector.

Returns:

1 if the intersections should be recalculated by a call to planeComputeInter(), 0 if not. Or -1 if there is an error.

Return type:

bool

Change the position of the plane.

setHiddenState(side)
Parameters:

side (int) – a key, v_sim.PLANE_SIDE_NONE, v_sim.PLANE_SIDE_PLUS or v_sim.PLANE_SIDE_MINUS.

Returns:

True if the hidding side was actually changed.

Return type:

bool

The plane can hide the nodes on one of its side. The side argument can be v_sim.PLANE_SIDE_PLUS or v_sim.PLANE_SIDE_MINUS or v_sim.PLANE_SIDE_NONE. It codes the side of the plane which hides the nodes. If v_sim.PLANE_SIDE_NONE is selected all nodes are rendered.

setNormalVector(vect)
Parameters:

vect ([float]) – three values defining the normal vector (unitary or not).

Returns:

1 if the intersections should be recalculated by a call to planeComputeInter(), 0 if not. Or -1 if there is an error.

Return type:

bool

Change the normal vector defining the orientation of the plane.

setOpacity(opacity)
Parameters:

opacity (float) – a float in [0;1].

Returns:

True if value is actually changed.

Return type:

bool

Defines the plane opacity. Planes can be coloured with alpha channel colours. The opacity is an additional parameter that can be used to animate plane apparition for instance.

New in version 3.8.

setOrigin(origin)
Parameters:

origin ([float]) – some cartesian coordinates.

Returns:

True if origin is actually changed.

Return type:

bool

Defines a point belonging to self instead of defining distance of self to the box origin.

New in version 3.8.

setRendered(rendered)
Parameters:

rendered (bool) – True to make the plane drawable.

Returns:

True if the visibility is actually changed.

Return type:

bool

Change the visibility of the plane.

Signal Details

v_sim.Plane.signals.moved(plane)
Signal Name:

moved

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:

plane (v_sim.Plane) – The object which received the signal

This signal is emitted each time the plane position is changed (either distance or normal).

New in version 3.3.

v_sim.Plane.signals.rendering(plane)
Signal Name:

rendering

Flags:

RUN_LAST, NO_RECURSE, NO_HOOKS

Parameters:

plane (v_sim.Plane) – The object which received the signal

This signal is emitted each time the rendering properties (color, visibility…) are affected.

New in version 3.7.

Property Details

v_sim.Plane.props.color
Name:

color

Type:

v_sim.Color

Default Value:

None

Flags:

READABLE, WRITABLE

rendering color

v_sim.Plane.props.distance
Name:

distance

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE

distance to origin

v_sim.Plane.props.hidding_side
Name:

hidding-side

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

hidding property

v_sim.Plane.props.n_vector
Name:

n-vector

Type:

Default Value:

None

Flags:

READABLE, WRITABLE

normal vector

v_sim.Plane.props.opacity
Name:

opacity

Type:

float

Default Value:

1.0

Flags:

READABLE, WRITABLE

opacity property

v_sim.Plane.props.rendered
Name:

rendered

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE

rendering property