Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #33041

Suggestion change of structure to fit multiple splines

Newsgroups comp.lang.javascript
Date 2017-04-18 02:27 -0700
Message-ID <08500c70-8c68-47fb-8766-e6023907de63@googlegroups.com> (permalink)
Subject Suggestion change of structure to fit multiple splines
From jonas.thornvall@gmail.com

Show all headers | View raw


I wanted to add splines to my array structure of nodes but i know to little about howto make array dependencies. I manage to make substructures like arr[i].nodelinks[j] but now there is another depth of level and i do not know howto resolv it without resort into create strings. Because each node can have many splines. So my suggested solution below would have to make a string of the nodes that make up the spline.

First i wasn't sure if the spline points should be attachable nodes at all it is just a curve afterall, but then i realised make things like  tubes rods and cones, and so on they should be connectable in the mesh/grid.

I had no problem with beziers because they are just 2 points, so i use them as overlay on the original connections. However with splines they can contain any number of points. But in the showcase i constructed below there can only be a single spline at each node.
I guess what i really would like is a structure like arr[i].nodelinks[j].spline[k] here spline is a "subelement?" connected to each nodelink, rather then each arr.

If anyone can show me howto acheive it i do not have to resort to stringhandling, which i beleive would be alot slower leading to performance penalties?

Using the structure below each spline could be hold as a string. 
arr[i].splinePointX[j]="*111*700*233*368*911";//Coordinates
But i think a structure like
arr[i].nodelinks[j].splinePointX[k]=257;
Would be better faster?



function makeNode(m){
  arr[m] = {
     nodelinks: [],
     hold: false,
     rposX: 0,
     rposY: 0,
     rwidth: 10,
     rheigth: 10,
     rcolor: "red",
     bcolor: "green",
     print: true,
     BcurveX1:[],
     BcurveY1:[],
     BcurveX2:[],
     BcurveY2:[],
     spineStartNode:undefined,
     splinePointX:[],
     splinePointY:[],
     splineEndNode:undefined,
     rposZ: 0
 };
 printnode[m]=m;
}

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Suggestion change of structure to fit multiple splines jonas.thornvall@gmail.com - 2017-04-18 02:27 -0700
  Re: Suggestion change of structure to fit multiple splines jonas.thornvall@gmail.com - 2017-04-18 02:39 -0700
  Re: Suggestion change of structure to fit multiple splines jonas.thornvall@gmail.com - 2017-04-18 15:04 -0700
    Re: Suggestion change of structure to fit multiple splines jonas.thornvall@gmail.com - 2017-04-18 18:32 -0700
  Re: Suggestion change of structure to fit multiple splines jonas.thornvall@gmail.com - 2017-04-21 04:58 -0700
    Re: Suggestion change of structure to fit multiple splines jonas.thornvall@gmail.com - 2017-04-21 05:07 -0700
      Re: Suggestion change of structure to fit multiple splines jonas.thornvall@gmail.com - 2017-04-21 05:27 -0700

csiph-web