I hate I'm asking for help again. Unfortunately it seems there just aren't any links I can find on making an array that holds a bunch of two dimensional arrays. Maybe my google-fu is lacking. Basically I have a header file like this:
When I try to compile with it I get lots of the following:
I've tried making these lines pointers:
Then I just get similar output at compile time:
To be honest, I'm a little shaky on what ‘int * (*)[10]' even means. I would guess that a pointer to a pointer where one has been cast, but I'm probably wrong. At least I would think so from the code I used.
I want to run an awk split on a value that has been pushed through an array and I was wondering what the syntax should be??
e.g. running time strings through an array and trying to examine just minutes:
12:25:30
10:15:13
08:55:23
awk '
NR==FNR{
... (2 Replies)
Hi,
I am trying to assign an array as a value to one of the array element, I mean
I have an array @KS and array @kr.
I want array @KS to hold @kr as an element.
So I am doin this
$KS=@kr;
But the value stored is number of elements in the @kr array.
Can... (2 Replies)
Suppose there are two arrays of arrays:
@A = ( , , , );
@B = ( , , , , );
For each of $A, $A, $A..., I want to find the corresponding one in @B (match the letter, like $A eq $B), and print out both the second item, for example, $A and $B.
How can I do this in perl? grep + map? Hope I... (1 Reply)
Hi All
I need to get <STDIN> from a user. the <STDIN> is a range of number delimited by "," (comma) and can be with range delimited by "-".
Example: 1,2,3,4-9,12,15,34-36,70
Now I need to get this from the user and go on each number and "Do something"... but when trying to do this as above... (2 Replies)
here is what i have...
i=1
while read line
do
if grep -i-q "create procedure"<<<$line
then
startline="$line"
endline="blahblah"
Get procedure name into a variable named procName
procName="procedure name is stored"
do some... (2 Replies)
Hi ,
i have a perl script which takes 'csv; file as input parameter and performs some tasks.
CSV file format :
MAGENTF,AGENTF8,mahfr001,tksfr01,. ./.profile 1>/dev/null 2>&1;ps -fe|grep 'gn1avm_agent -n AGENTF8'|grep gn1avm_agent|tr -s '' ''|cut -d ' ' -f 3|xargs kill -9,,. ./.profile... (3 Replies)
hello,
i need a bit of help on how to do this effectively in bash without a lot of extra looping or massive switch/case
i have a long array of M elements and a short array of N elements, so M > N always. M is not a multiple of N.
for case 1, I want to stretch N to fit M
arrayHuge
H = (... (2 Replies)
Corona688 was great in helping me learn how to create arrays that hold other two dimensional array here. Unfortunately I didn't think ask about how to implement or call them. Basically, I'm trying to call an array of two-dimensional arrays like this:
declaration:
int (*side_one) = { { white_l1,... (6 Replies)
Le sigh... Hopefully this will be the last time I have to ask for help on this topic. For a while now I've been working with a 1d array that holds 2d arrays. For reference you can view here. Now I'm just trying to loop through the elements with the following:
#include <stdio.h>
void... (3 Replies)
Discussion started by: Azrael
3 Replies
LEARN ABOUT PLAN9
matrix
MATRIX(9.2) MATRIX(9.2)
NAME
ident, matmul, matmulr, determinant, adjoint, invertmat, xformpoint, xformpointd, xformplane, pushmat, popmat, rot, qrot, scale, move,
xform, ixform, persp, look, viewport - Geometric transformations
SYNOPSIS
#include <libg.h>
#include <geometry.h>
void ident(Matrix m)
void matmul(Matrix a, Matrix b)
void matmulr(Matrix a, Matrix b)
double determinant(Matrix m)
void adjoint(Matrix m, Matrix madj)
double invertmat(Matrix m, Matrix inv)
Point3 xformpoint(Point3 p, Space *to, Space *from)
Point3 xformpointd(Point3 p, Space *to, Space *from)
Point3 xformplane(Point3 p, Space *to, Space *from)
Space *pushmat(Space *t)
Space *popmat(Space *t)
void rot(Space *t, double theta, int axis)
void qrot(Space *t, Quaternion q)
void scale(Space *t, double x, double y, double z)
void move(Space *t, double x, double y, double z)
void xform(Space *t, Matrix m)
void ixform(Space *t, Matrix m, Matrix inv)
int persp(Space *t, double fov, double n, double f)
void look(Space *t, Point3 eye, Point3 look, Point3 up)
void viewport(Space *t, Rectangle r, double aspect)
DESCRIPTION
These routines manipulate 3-space affine and projective transformations, represented as 4x4 matrices, thus:
typedef double Matrix[4][4];
Ident stores an identity matrix in its argument. Matmul stores axb in a. Matmulr stores bxa in b. Determinant returns the determinant of
matrix m. Adjoint stores the adjoint (matrix of cofactors) of m in madj. Invertmat stores the inverse of matrix m in minv, returning m's
determinant. Should m be singular (determinant zero), invertmat stores its adjoint in minv.
The rest of the routines described here manipulate Spaces and transform Point3s. A Point3 is a point in three-space, represented by its
homogeneous coordinates:
typedef struct Point3 Point3;
struct Point3{
double x, y, z, w;
};
The homogeneous coordinates (x, y, z, w) represent the Euclidean point (x/w, y/w, z/w) if w!=0, and a ``point at infinity'' if w=0.
A Space is just a data structure describing a coordinate system:
typedef struct Space Space;
struct Space{
Matrix t;
Matrix tinv;
Space *next;
};
It contains a pair of transformation matrices and a pointer to the Space's parent. The matrices transform points to and from the ``root
coordinate system,'' which is represented by a null Space pointer.
Pushmat creates a new Space. Its argument is a pointer to the parent space. Its result is a newly allocated copy of the parent, but with
its next pointer pointing at the parent. Popmat discards the Space that is its argument, returning a pointer to the stack. Nominally,
these two functions define a stack of transformations, but pushmat can be called multiple times on the same Space multiple times, creating
a transformation tree.
Xformpoint and Xformpointd both transform points from the Space pointed to by from to the space pointed to by to. Either pointer may be
null, indicating the root coordinate system. The difference between the two functions is that xformpointd divides x, y, z, and w by w, if
w!=0, making (x, y, z) the Euclidean coordinates of the point.
Xformplane transforms planes or normal vectors. A plane is specified by the coefficients (a, b, c, d) of its implicit equation
ax+by+cz+d=0. Since this representation is dual to the homogeneous representation of points, libgeometry represents planes by Point3
structures, with (a, b, c, d) stored in (x, y, z, w).
The remaining functions transform the coordinate system represented by a Space. Their Space * argument must be non-null -- you can't mod-
ify the root Space. Rot rotates by angle theta (in radians) about the given axis, which must be one of XAXIS, YAXIS or ZAXIS. Qrot trans-
forms by a rotation about an arbitrary axis, specified by Quaternion q.
Scale scales the coordinate system by the given scale factors in the directions of the three axes. Move translates by the given displace-
ment in the three axial directions.
Xform transforms the coordinate system by the given Matrix. If the matrix's inverse is known a priori, calling ixform will save the work
of recomputing it.
Persp does a perspective transformation. The transformation maps the frustum with apex at the origin, central axis down the positive y
axis, and apex angle fov and clipping planes y=n and y=f into the double-unit cube. The plane y=n maps to y'=-1, y=f maps to y'=1.
Look does a view-pointing transformation. The eye point is moved to the origin. The line through the eye and look points is aligned with
the y axis, and the plane containing the eye, look and up points is rotated into the x-y plane.
Viewport maps the unit-cube window into the given screen viewport. The viewport rectangle r has r.min at the top left-hand corner, and
r.max just outside the lower right-hand corner. Argument aspect is the aspect ratio (dx/dy) of the viewport's pixels (not of the whole
viewport). The whole window is transformed to fit centered inside the viewport with equal slop on either top and bottom or left and right,
depending on the viewport's aspect ratio. The window is viewed down the y axis, with x to the left and z up. The viewport has x increas-
ing to the right and y increasing down. The window's y coordinates are mapped, unchanged, into the viewport's z coordinates.
SOURCE
/sys/src/libgeometry/matrix.c
MATRIX(9.2)