set column position with Susy - susy-compass

How do I set where the columns show up in Susy?
I thought this would work:
#idLeftColumn{
#include span(1 at 1 first);
}
#idMiddleColumn{
#include span(1 at 2);
}
#idRightColumn{
#include span(1 at 3 last);
}
The html code has the order middle column, left column and then right column.
The website is showing the middle column first. This is the order in the source code.
Here is the full code: http://sassmeister.com/gist/60d85878921ca500c681

Susy uses standard float layout by default. Because floats stack up in the flow, you can't position them in any "absolute" way — you have to push or pull them from one position to another. Susy has no way of knowing their default position in the flow, but you can do it manually with the push() and pull() mixins.
Or you can use the isolation output option, which uses negative margins to pull everything flush left — and then allows you to position them in the way you are attempting above.
You can either do that inline:
#idLeftColumn{
#include span(1 at 1 isolate); // "at 1 first" is redundant
}
#idMiddleColumn{
#include span(1 at 2 isolate);
}
Or you can do it globally:
#include layout(isolate);
#idLeftColumn{
#include span(1 at 1); // "at 1 first" is redundant
}
#idMiddleColumn{
#include span(1 at 2);
}

Related

Remove Underline under FLTK Menu Options

I'm creating a MenuBar in FLTK, and can't figure out how to remove the little underlines under each menu category. What setting controls this?
When you specify the labels of menu's entries, you have to remove &: see the examples below.
With &:
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <iostream>
#include <FL/Fl_Menu_Bar.H>
int main() {
Fl_Double_Window* G_win = new Fl_Double_Window(200,200);
Fl_Menu_Bar *menu = new Fl_Menu_Bar(0,0,400,25);
menu->add("&File"); // F is underlined
menu->add("Edi&t"); // t is underlined
G_win->show();
return(Fl::run());
}
Without &:
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <iostream>
#include <FL/Fl_Menu_Bar.H>
int main() {
Fl_Double_Window* G_win = new Fl_Double_Window(200,200);
Fl_Menu_Bar *menu = new Fl_Menu_Bar(0,0,400,25);
menu->add("File"); // No letter is underlined
menu->add("Edit"); // No letter is underlined
G_win->show();
return(Fl::run());
}
In the last case, the label of each menu does not have any underlined letter. See here for a more detailed explanation.

Color points on CGAL Triangulation_3

I am trying to give a color to the points into a triangulation_3 on CGAL. I just take the example from CGAL describe here
I made a simple modification on this example to be able to draw the triangulation:
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Delaunay_triangulation_cell_base_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_3.h>
#include <CGAL/IO/Color.h>
#include <CGAL/draw_triangulation_3.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_vertex_base_with_info_3<CGAL::Color, K> Vb;
typedef CGAL::Delaunay_triangulation_cell_base_3<K> Cb;
typedef CGAL::Triangulation_data_structure_3<Vb, Cb> Tds;
typedef CGAL::Delaunay_triangulation_3<K, Tds> Delaunay;
typedef Delaunay::Point Point;
int main()
{
Delaunay T;
T.insert(Point(0,0,0));
T.insert(Point(1,0,0));
T.insert(Point(0,1,0));
T.insert(Point(0,0,1));
T.insert(Point(2,2,2));
T.insert(Point(-1,0,1));
// Set the color of finite vertices of degree 6 to red.
Delaunay::Finite_vertices_iterator vit;
for (Delaunay::Vertex_handle v : T.finite_vertex_handles())
if (T.degree(v) == 6)
v->info() = CGAL::Color(0,255,0);
CGAL::draw(T);
return 0;
}
But no matter which color I put on v->info() = CGAL::Color(0,255,0); the method draw always give the same red points in the window displayed:
I understand that the code is constructing a data structure that contains color information but this could be independent of the draw method, so i think that the window doesn't show me green points because this is not the way to color the points. If so, what is the way to get a triangulation with green points using the draw method?'.
In its current form, the viewer is not able to change the color of vertices nor edges.
But it is easy to change the code.
Copy the file draw_triangulation_3.h in your project
edit the method void compute_vertex(Vertex_const_handle vh), (line 92 in this file) to use the add_point method with a color as parameter: add_point(vh->point(), vh->info());

Transparency on one face of cube OpenScreenGraph

I have imported object (Cube) from 3dsMax in my OSG project in VisualStudio. But I can't find out how to make transparent only one face of this imported cube. this is my code:
#include <osgViewer/Viewer>
#include <iostream>
#include <osg/Group>
#include <osg/Node>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osg/Notify>
#include <osg/MatrixTransform>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/StateSet>
#include <osg/StateAttribute>
#include <osg/CullFace>
#include <osg/Point>
#include <osg/Light>
#include <osg/LightSource>
#include <osg/BlendFunc>
#include <osg/Material>
#include <osg/PolygonMode>
int main(int argc, char** argv)
{
osg::ref_ptr<osg::Group> root = new osg::Group;
osg::ref_ptr<osg::Node> model = osgDB::readNodeFile("cube.3ds"); //Importing model
osg::StateSet* state2 = model->getOrCreateStateSet(); //Creating material
osg::ref_ptr<osg::Material> mat2 = new osg::Material;
mat2->setAlpha(osg::Material::FRONT_AND_BACK, 0.1); //Making alpha channel
state2->setAttributeAndModes( mat2.get() ,
osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
osg::BlendFunc* bf = new //Blending
osg::BlendFunc(osg::BlendFunc::SRC_ALPHA,
osg::BlendFunc::ONE_MINUS_DST_COLOR );
state2->setAttributeAndModes(bf);
root->addChild(model.get());
osgViewer::Viewer viewer;
viewer.setSceneData(root.get());
viewer.setUpViewOnSingleScreen(0);
return viewer.run();
}
This is my source with just imported file. I've tried implement transparency with multiple passes but have no success.
Is there any method how could i make it ?
The code in the question does make the model transparent. For example, with the cessna model from the OSG data package:
Adding two more models, a box and a sphere, where the box also has blending:
We see that blending is working. If you add another model but it isn't displayed, then probably the plane is being rendered before the other models. If the plane happens to be in front of the other models, even if the plane is transparent, you won't see them; as they don't pass the depth test.
Adding
cessna->getStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON );
cessna->getStateSet()->setRenderingHint( osg::StateSet::TRANSPARENT_BIN );
forces the cessna to be rendered after the opaque models.
Also, note that if you provide a blending function, then you don't need to call
cessna->getStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON );
Let's see another scene, where the box is behind the plane and we haven't set the rendering hint:
And now with the rendering hint active:

Can't use memcpy on char * attribute as destination - visual c++

I have the following piece of code in appPOSWebDlg.cpp:
#include "stdafx.h"
#include "afx.h"
#include <stdlib.h>
#include <Ras.h>
...
//Attribute
char *site;
...
// Method
int readFile() {
char * aux;
int result;
result = readParameter(hFile, aux);
if (result == 0) {
memcpy(site, aux, 256);
} else {
return 1;
}
return 0;
}
But the program stops at the memcpy line and I'm not sure why. After debugging, I can confirm that the aux parameter is being assigned correctly with the value expected. Furthermore, I even used the memcpy inside the readParameter method to assign it and had no problem. So why can't I assign that value to attribute site using the same method?
Your "site" pointer is invalid. You've defined it as a pointer, but, not allocated any space for it, so, your copy command is overlaying some code. You'll need to allocated the pointer correctly by performing a "new" and a "delete" when you are done.

picking up random numbers from a text file in c++

If a text file contains numbers in 100 rows * 100 columns (for example). Now i want my program to pick up ,for example , one number from 60th row and 97th column and then assign this value to a variable and perform some calculation with this variable. So i want to pick up some random numbers from a text file which contains a lot of numbers. how can i do that??
I made a code for practice but its giving some error.
the text file contains 6 different digits in 2 rows and 3 columns
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
int data[6],i=0;
ifstream myfile;
myfile.open ("a.txt");
while (i<<6)
{
myfile>>data[i];
i=i+1;
}
myfile.close();
cout<<data[0]<<"\t"<<data[1]<<"\t"<<data[2]<<"\t"<<data[3]<<"\t"<<data[4]<<"\t" <<data[5]<<"\n";
system("pause");
return 0;
}
while (i < 6)
{
myfile>>data[i];
i=i+1;
}

Resources