Page Loading... please wait!


This message not going away?
Ensure Javascript is on and click the box
Jul 22, 2017 - 01:29 AM  
Realsoft.org  
 
 

Realsoft.org FAQs (frequently-asked questions)

Category: Main -> JavaScript

Question

Answer

I need to import camera tracking data to Realsoft3D. I can write the javascrip code for this, but I don't know how to read ascii files from javascript. Any help would be highly appreciated.


// open file for reading
file = new r3File(0);
file.SetName("myasciifile.txt");
file.SetMode("ra");
file.OPEN();

// read line by line
while(file.GETS[0]) {
line = file.GetBuffer();

// parse line
.....
}

file.CLOSE();

Back to top
Hi,

I am trying to figure out how to align an object with a face, as in placing an analytic cube with it's base aligned with the face of an sds sphere.

Use GETFACESPACE() method.

// fetch the face space in objects space
var cs = new r3Coordsys();
Self.GETFACESPACE(faceindex, cs);

// map cs to abs space
Self.POINTTOABSSPACE(cs.origin);
Self.POINTTOABSSPACEL(cs.hor);
Self.POINTTOABSSPACEL(cs.vert);
Self.POINTTOABSSPACEL(cs.norm);

// scale down a bit
var p1 = cs.hor.mul(0.01);
var p2 = cs.vert.mul(0.01);
var p3 = cs.norm.mul(0.1);

// create a cube
include("real/objects/r3cube.js");

var cube = new r3Cube(0);
cube.SetP0(cs.origin);
cube.SetP1(cs.origin.add(p1));
cube.SetP2(cs.origin.add(p2));
cube.SetP3(cs.origin.add(p3));

Regards,
Juha Meskanen, Realsoft

Back to top
I'm trying to study whether my sds object is in face select mode. I have tried GetFaceSelection() method, but it doesn't seem to do what I expected.

SDS defines three selection modes:

R3SUBDIVR_POINT,
R3SUBDIVR_EDGE,
R3SUBDIVR_FACE

To fetch the current mode, call:

mode = mysds.GetSelectResolution();

if(select_state != R3SUBDIVR_FACE ) {
....
}


Kind regards,
Juha Meskanen,
Realsoft

Back to top

Login





 


 Log in Problems?
 New User? Sign Up!

Realsoft Graphics
Copyright © 1989 ... 2012
Realsoft Graphics