zNear and zFar plane Size

Following math works for perspective projection.

aEwwS

Height of zNear, another words it’s height of near plane:

 float H_near = 2*near*tan(fovy/2);

And the same for zFar, to get height of far plane:

 float H_far = 2*far*tan(fovy/2);

To get width, just multiple on aspect ratio of your screen.

Posted in others
Tagged Math, , perspective, plane, zFar, zNear

Charts control with animations for iOS

Almost half year ago I’ve made this control. For one idea, but then I found that my idea does not good enough to be implemented.

It has just 2 classes VBPieChart, superclass UIView, and VBPiePiece, superclass CAShapeLayer. And really used just VBPieChart. All chart based on CALayer’s and depends to QuartzCore.

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
VBPieChart *_chart = [[VBPieChart alloc] init];
[self.view addSubview:_chart];
   
[_chart setFrame:CGRectMake(10, 50, 300, 300)];
[_chart setEnableStrokeColor:YES];
_chart.length = M_PI;
_chart.startAngle = M_PI;

[_chart.layer setShadowOffset:CGSizeMake(2, 2)];
[_chart.layer setShadowRadius:3];
[_chart.layer setShadowColor:[UIColor blackColor].CGColor];
[_chart.layer setShadowOpacity:0.7];

[_chart setHoleRadiusPrecent:0.3];
NSDictionary *chartValues = @{

                       @"data one":  @{@"value":@35 },
                       @"data two":  @{@"value":@20 },
                       @"data tree":  @{@"value":@10 },
                       @"first ":  @{@"value":@40},
                       @"second": @20,
                       @"third": @40,
                       @"fourth": @10,
                       };

[_chart setChartValues:chartValues animation:YES];

chartValues contains items of chart.
1. name of piece
2. dictionary with NSNumber or parameters:
– value actually size of piece
– color, UIColor
– accent, bool value to show this item with shift

VBPieChart has 5 different types of animations.

Cocoacontrols logo

cocoapods logo

Posted in iOS
Tagged Animation, CAAnimation, CABasicAnimation, CALayer, CAShapeLayer, Chart, Charts, Control, dev, , ,

Share source code of my app

I’ve uploaded source code of my app on Github under MIT license.

App and code is free, you can do with it where you want.
If you will want add some improvements for app, I may will release them in next version ;)

Thanks

P.S.: Code not cleaned and lack of comments.

Rotate model with GLKit – Quaternions and Matrices math

I was looking for algorithm to apply additional rotation to model with current rotation matrix, and found this:

1
2
3
GLKVector3 up = GLKVector3Make(0.f, 1.f, 0.f);
up = GLKQuaternionRotateVector3( GLKQuaternionInvert(quarternion), up );
GLKQuaternion quarternion = GLKQuaternionMultiply(quarternion, GLKQuaternionMakeWithAngleAndVector3Axis(delta.x * RADIANS_PER_PIXEL, up));

It’s from this small tutorial about rotation:
A bit modified code, source here
Under code a bit more text and links
Continue reading

ClipMaker – первое приложение в App store ради опыта.

Не судите меня строго, но на порыве популярности #selfie решил сделать приложение :)
Хочется посмотреть, выйдет ли что-то из этого.
Сам же таким не страдаю и нравится использовать приложение для других целей.
Написал за нескольно дней и поэтому не может подвергаться критике ;)
Доступно со вчерашнего дня и бесплатно. Всю собранную статистику опубликую.

Download_on_the_App_Store_Badge_US-UK_135x40

Страничка на сайте

Мне больше нравится делать видео, следующего содержания:

Configuring and compiling VTK 6.1 on Mac OS X 10.9.2 + simple example of VTK usage

Hello. In this short post I will explain how to build static libraries of VTK.
Main reason why it needs: Because official “How to” has just 2 lines without any explanations. And by default will be builded dynamic libraries. With which I had a problem like link to vtkCocoaGLView was not found, but it actually was in a library.

Let’s start. You will need CMake to build and VTK sources.

- Launch CMake from your Application folder. In main menu go to “Tool” -> “Install for Command Line Use”, in case if you did not install yet.
- Unpack VTK to some directory, working place.
- Enter to VTK directory and create directory with name build

Now you can configure and generate makefile or Xcode project file from console or User interface of CMake application.
If you would like to build with makefile in terminal go to next steps, if not jump to Build with Xcode section.
Continue reading

1 2 3 23 Next »